Tipsy\Request::__construct PHP Метод

__construct() публичный Метод

public __construct ( $args = [] )
    public function __construct($args = [])
    {
        $this->_properties = [];
        /** dont think this is needed, but leaving here just in case
        		if ($args['tipsy']) {
        			$this->_tipsy = $args['tipsy'];
        		}
        		**/
        if ($this->method()) {
            switch ($this->method()) {
                case 'GET':
                    if ($this->_contentType() === 'application/x-www-form-urlencoded' || !$this->_contentType()) {
                        $this->_properties = $_GET;
                    } elseif ($this->_contentType() === 'application/json') {
                        $this->_properties = $this->raw();
                    }
                    break;
                case 'POST':
                    if ($this->_contentType() === 'application/json') {
                        $this->_properties = json_decode($this->content(), 'array');
                    } elseif ($this->_contentType() === 'multipart/form-data') {
                        $this->_properties = $_REQUEST;
                    } else {
                        $this->_properties = $_POST;
                    }
                    break;
                case 'PUT':
                case 'DELETE':
                default:
                    if ($this->_contentType() === 'application/x-www-form-urlencoded') {
                        parse_str($this->content(), $this->_properties);
                    } elseif ($this->_contentType() === 'application/json') {
                        $content = $this->content();
                        $request = json_decode($content, 'array');
                        if (!$request) {
                            $this->_properties = false;
                        } else {
                            $this->_properties = $request;
                        }
                    }
                    break;
            }
        }
    }