lithium\action\Request::_init()

protected method

Initializes request object by setting up mobile detectors, determining method and populating the data property either by using i.e. form data or reading from STDIN in case binary data is streamed. Will merge any files posted in forms with parsed data.

Note that only beginning with PHP 5.6 STDIN can be opened/read and closed more than once.

Source

	protected function _init() {
		parent::_init();

		$mobile = array(
			'iPhone', 'MIDP', 'AvantGo', 'BlackBerry', 'J2ME', 'Opera Mini', 'DoCoMo', 'NetFront',
			'Nokia', 'PalmOS', 'PalmSource', 'portalmmm', 'Plucker', 'ReqwirelessWeb', 'iPod',
			'SonyEricsson', 'Symbian', 'UP\.Browser', 'Windows CE', 'Xiino', 'Android'
		);
		if (!empty($this->_config['detectors']['mobile'][1])) {
			$mobile = array_merge($mobile, (array) $this->_config['detectors']['mobile'][1]);
		}
		$this->_detectors['mobile'][1] = $mobile;

		$this->data = (array) $this->_config['data'];

		if (isset($this->data['_method'])) {
			$this->_computed['HTTP_X_HTTP_METHOD_OVERRIDE'] = strtoupper($this->data['_method']);
			unset($this->data['_method']);
		}
		$type = $this->type($this->_config['type'] ?: $this->env('CONTENT_TYPE'));
		$this->method = strtoupper($this->env('REQUEST_METHOD'));
		$hasBody = in_array($this->method, array('POST', 'PUT', 'PATCH'));

		if (!$this->body && $hasBody && $type !== 'html') {
			$this->_stream = $this->_stream ?: fopen('php://input', 'r');
			$this->body = stream_get_contents($this->_stream);
			fclose($this->_stream);
		}
		if (!$this->data && $this->body) {
			$this->data = $this->body(null, array('decode' => true, 'encode' => false));
		}
		$this->body = $this->data;

		if ($this->_config['globals'] && !empty($_FILES)) {
			$this->data = Set::merge($this->data, $this->_parseFiles($_FILES));
		}
	}