public function init( $config = [ ] )
    {
        if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) )
        {
            $this->userAgent = $_SERVER[ 'HTTP_USER_AGENT' ];
        }
        if ( isset( $_SERVER[ 'SERVER_NAME' ] ) )
        {
            $this->server = $_SERVER[ 'SERVER_NAME' ];
        }
        if ( isset( $_SERVER[ 'SERVER_PORT' ] ) )
        {
            $this->port = $_SERVER[ 'SERVER_PORT' ];
        }
        if ( isset( $_SERVER[ 'REQUEST_METHOD' ] ) )
        {
            $this->method = $_SERVER[ 'REQUEST_METHOD' ];
        }
        if ( isset( $_SERVER[ 'QUERY_STRING' ] ) )
        {
            $this->query = $_SERVER[ 'QUERY_STRING' ];
        }
        if ( isset( $_SERVER[ 'SCRIPT_NAME' ] ) )
        {
            $this->script = $_SERVER[ 'SCRIPT_NAME' ];
        }
        if ( isset( $_SERVER[ 'REQUEST_URI' ] ) )
        {
            $this->requestUri = $_SERVER[ 'REQUEST_URI' ];
        }
        if ( isset( $_SERVER[ 'REQUEST_SCHEME' ] ) )
        {
            $this->scheme = $_SERVER[ 'REQUEST_SCHEME' ];
        }

        $request = str_replace( $_SERVER[ 'SCRIPT_NAME' ], '', $this->requestUri );

        $elements = explode( '/', $request );

        if ( '' === $elements[ 0 ] )
        {
            array_shift( $elements );
        }

        if ( 2 <= count( $elements ) )
        {
            $this->route = $elements[ 0 ] . '/' . $elements[ 1 ];

            array_shift( $elements );
            array_shift( $elements );

            if ( 0 < count( $elements ) )
            {
                $this->params = $elements;
            }
        }
        else if ( 1 === count( $elements ) )
        {
            $this->route = $elements[ 0 ];

            array_shift( $elements );
        }
    }
public function init( $config = [ ] )
    {
        if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) )
        {
            $this->userAgent = $_SERVER[ 'HTTP_USER_AGENT' ];
        }
        if ( isset( $_SERVER[ 'SERVER_NAME' ] ) )
        {
            $this->server = $_SERVER[ 'SERVER_NAME' ];
        }
        if ( isset( $_SERVER[ 'SERVER_PORT' ] ) )
        {
            $this->port = $_SERVER[ 'SERVER_PORT' ];
        }
        if ( isset( $_SERVER[ 'REQUEST_METHOD' ] ) )
        {
            $this->method = $_SERVER[ 'REQUEST_METHOD' ];
        }
        if ( isset( $_SERVER[ 'QUERY_STRING' ] ) )
        {
            $this->query = $_SERVER[ 'QUERY_STRING' ];
        }
        if ( isset( $_SERVER[ 'SCRIPT_NAME' ] ) )
        {
            $this->script = $_SERVER[ 'SCRIPT_NAME' ];
        }
        if ( isset( $_SERVER[ 'REQUEST_URI' ] ) )
        {
            $this->requestUri = $_SERVER[ 'REQUEST_URI' ];
        }
        if ( isset( $_SERVER[ 'REQUEST_SCHEME' ] ) )
        {
            $this->scheme = $_SERVER[ 'REQUEST_SCHEME' ];
        }

        $request = str_replace( $_SERVER[ 'SCRIPT_NAME' ], '', $this->requestUri );

        $elements = explode( '/', $request );

        if ( '' === $elements[ 0 ] )
        {
            array_shift( $elements );
        }

        if ( 2 <= count( $elements ) )
        {
            $this->route = $elements[ 0 ] . '/' . $elements[ 1 ];

            array_shift( $elements );
            array_shift( $elements );

            if ( 0 < count( $elements ) )
            {
                $this->params = $elements;
            }
        }
        else if ( 1 === count( $elements ) )
        {
            $this->route = $elements[ 0 ];

            array_shift( $elements );
        }
    }
public function init ( $ config = [ ] ) { if ( isset ( $ _SERVER [ 'HTTP_USER_AGENT' ] ) ) { $ this -> userAgent = $ _SERVER [ 'HTTP_USER_AGENT' ] ; } if ( isset ( $ _SERVER [ 'SERVER_NAME' ] ) ) { $ this -> server = $ _SERVER [ 'SERVER_NAME' ] ; } if ( isset ( $ _SERVER [ 'SERVER_PORT' ] ) ) { $ this -> port = $ _SERVER [ 'SERVER_PORT' ] ; } if ( isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) ) { $ this -> method = $ _SERVER [ 'REQUEST_METHOD' ] ; } if ( isset ( $ _SERVER [ 'QUERY_STRING' ] ) ) { $ this -> query = $ _SERVER [ 'QUERY_STRING' ] ; } if ( isset ( $ _SERVER [ 'SCRIPT_NAME' ] ) ) { $ this -> script = $ _SERVER [ 'SCRIPT_NAME' ] ; } if ( isset ( $ _SERVER [ 'REQUEST_URI' ] ) ) { $ this -> requestUri = $ _SERVER [ 'REQUEST_URI' ] ; } if ( isset ( $ _SERVER [ 'REQUEST_SCHEME' ] ) ) { $ this -> scheme = $ _SERVER [ 'REQUEST_SCHEME' ] ; } $ request = str_replace ( $ _SERVER [ 'SCRIPT_NAME' ] , '' , $ this -> requestUri ) ; $ elements = explode ( '/' , $ request ) ; if ( '' === $ elements [ 0 ] ) { array_shift ( $ elements ) ; } if ( 2 <= count ( $ elements ) ) { $ this -> route = $ elements [ 0 ] . '/' . $ elements [ 1 ] ; array_shift ( $ elements ) ; array_shift ( $ elements ) ; if ( 0 < count ( $ elements ) ) { $ this -> params = $ elements ; } } else if ( 1 === count ( $ elements ) ) { $ this -> route = $ elements [ 0 ] ; array_shift ( $ elements ) ; } }
Initialises the request.

@param array $config optional configuration array
Initialises the request .