src/RawPHP/RawApplication/Application.php
protected function initRouter( array $config )
    {
        if ( isset( $config[ 'router' ] ) )
        {
            if ( isset( $config[ 'router' ][ 'class' ] ) )
            {
                $this->bindShared( 'RawPHP\RawRouter\Contract\IRouter', function () use ( $config )
                {
                    $class = $config[ 'router' ][ 'class' ];

                    return new $class( $config[ 'router' ] );
                }
                );
            }
            else
            {
                $this->bindShared( 'RawPHP\RawRouter\Contract\IRouter', function () use ( $config )
                {
                    return new Router( $config[ 'router' ] );
                }
                );
            }
        }
        else
        {
            $this->bindShared( 'RawPHP\RawRouter\Contract\IRouter', function ()
            {
                return new Router();
            }
            );
        }

        $this->alias( 'RawPHP\RawRouter\Contract\IRouter', 'RawPHP\RawRouter\Router' );
        $this->alias( 'RawPHP\RawRouter\Contract\IRouter', 'router' );

        $this[ 'router' ]->setDispatcher( $this[ 'dispatcher' ] );

        $this->defaultController = $this[ 'router' ]->getDefaultController();
        $this->defaultAction     = $this[ 'router' ]->getDefaultAction();
    }
protected function initRouter( array $config )
    {
        if ( isset( $config[ 'router' ] ) )
        {
            if ( isset( $config[ 'router' ][ 'class' ] ) )
            {
                $this->bindShared( 'RawPHP\RawRouter\Contract\IRouter', function () use ( $config )
                {
                    $class = $config[ 'router' ][ 'class' ];

                    return new $class( $config[ 'router' ] );
                }
                );
            }
            else
            {
                $this->bindShared( 'RawPHP\RawRouter\Contract\IRouter', function () use ( $config )
                {
                    return new Router( $config[ 'router' ] );
                }
                );
            }
        }
        else
        {
            $this->bindShared( 'RawPHP\RawRouter\Contract\IRouter', function ()
            {
                return new Router();
            }
            );
        }

        $this->alias( 'RawPHP\RawRouter\Contract\IRouter', 'RawPHP\RawRouter\Router' );
        $this->alias( 'RawPHP\RawRouter\Contract\IRouter', 'router' );

        $this[ 'router' ]->setDispatcher( $this[ 'dispatcher' ] );

        $this->defaultController = $this[ 'router' ]->getDefaultController();
        $this->defaultAction     = $this[ 'router' ]->getDefaultAction();
    }
protected function initRouter ( array $ config ) { if ( isset ( $ config [ 'router' ] ) ) { if ( isset ( $ config [ 'router' ] [ 'class' ] ) ) { $ this -> bindShared ( 'RawPHP\RawRouter\Contract\IRouter' , function ( ) use ( $ config ) { $ class = $ config [ 'router' ] [ 'class' ] ; return new $ class ( $ config [ 'router' ] ) ; } ) ; } else { $ this -> bindShared ( 'RawPHP\RawRouter\Contract\IRouter' , function ( ) use ( $ config ) { return new Router ( $ config [ 'router' ] ) ; } ) ; } } else { $ this -> bindShared ( 'RawPHP\RawRouter\Contract\IRouter' , function ( ) { return new Router ( ) ; } ) ; } $ this -> alias ( 'RawPHP\RawRouter\Contract\IRouter' , 'RawPHP\RawRouter\Router' ) ; $ this -> alias ( 'RawPHP\RawRouter\Contract\IRouter' , 'router' ) ; $ this [ 'router' ] -> setDispatcher ( $ this [ 'dispatcher' ] ) ; $ this -> defaultController = $ this [ 'router' ] -> getDefaultController ( ) ; $ this -> defaultAction = $ this [ 'router' ] -> getDefaultAction ( ) ; }
Initialises the router.

@param array $config configuration array
Initialises the router .