public function init() {
        static $initialized = false;
        $self = $this;

        if ($initialized) {
            $this->vars = array();
            $this->loader->reset();
            $this->dispatcher->reset();
        }

        // Register default components
        $this->loader->register('request', '\flight\net\Request');
        $this->loader->register('response', '\flight\net\Response');
        $this->loader->register('router', '\flight\net\Router');
        $this->loader->register('view', '\flight\template\View', array(), function($view) use ($self) {
            $view->path = $self->get('flight.views.path');
            $view->extension = $self->get('flight.views.extension');
        });

        // Register framework methods
        $methods = array(
            'start','stop','route','halt','error','notFound',
            'render','redirect','etag','lastModified','json','jsonp'
        );
        foreach ($methods as $name) {
            $this->dispatcher->set($name, array($this, '_'.$name));
        }

        // Default configuration settings
        $this->set('flight.base_url', null);
        $this->set('flight.case_sensitive', false);
        $this->set('flight.handle_errors', true);
        $this->set('flight.log_errors', false);
        $this->set('flight.views.path', './views');
        $this->set('flight.views.extension', '.php');

        // Startup configuration
        $this->before('start', function() use ($self) {
            // Enable error handling
            if ($self->get('flight.handle_errors')) {
                set_error_handler(array($self, 'handleError'));
                set_exception_handler(array($self, 'handleException'));
            }

            // Set case-sensitivity
            $self->router()->case_sensitive = $self->get('flight.case_sensitive');
        });

        $initialized = true;
    }
public function init() {
        static $initialized = false;
        $self = $this;

        if ($initialized) {
            $this->vars = array();
            $this->loader->reset();
            $this->dispatcher->reset();
        }

        // Register default components
        $this->loader->register('request', '\flight\net\Request');
        $this->loader->register('response', '\flight\net\Response');
        $this->loader->register('router', '\flight\net\Router');
        $this->loader->register('view', '\flight\template\View', array(), function($view) use ($self) {
            $view->path = $self->get('flight.views.path');
            $view->extension = $self->get('flight.views.extension');
        });

        // Register framework methods
        $methods = array(
            'start','stop','route','halt','error','notFound',
            'render','redirect','etag','lastModified','json','jsonp'
        );
        foreach ($methods as $name) {
            $this->dispatcher->set($name, array($this, '_'.$name));
        }

        // Default configuration settings
        $this->set('flight.base_url', null);
        $this->set('flight.case_sensitive', false);
        $this->set('flight.handle_errors', true);
        $this->set('flight.log_errors', false);
        $this->set('flight.views.path', './views');
        $this->set('flight.views.extension', '.php');

        // Startup configuration
        $this->before('start', function() use ($self) {
            // Enable error handling
            if ($self->get('flight.handle_errors')) {
                set_error_handler(array($self, 'handleError'));
                set_exception_handler(array($self, 'handleException'));
            }

            // Set case-sensitivity
            $self->router()->case_sensitive = $self->get('flight.case_sensitive');
        });

        $initialized = true;
    }
public function init ( ) { static $ initialized = false ; $ self = $ this ; if ( $ initialized ) { $ this -> vars = array ( ) ; $ this -> loader -> reset ( ) ; $ this -> dispatcher -> reset ( ) ; } // Register default components $ this -> loader -> register ( 'request' , '\flight\net\Request' ) ; $ this -> loader -> register ( 'response' , '\flight\net\Response' ) ; $ this -> loader -> register ( 'router' , '\flight\net\Router' ) ; $ this -> loader -> register ( 'view' , '\flight\template\View' , array ( ) , function ( $ view ) use ( $ self ) { $ view -> path = $ self -> get ( 'flight.views.path' ) ; $ view -> extension = $ self -> get ( 'flight.views.extension' ) ; } ) ; // Register framework methods $ methods = array ( 'start' , 'stop' , 'route' , 'halt' , 'error' , 'notFound' , 'render' , 'redirect' , 'etag' , 'lastModified' , 'json' , 'jsonp' ) ; foreach ( $ methods as $ name ) { $ this -> dispatcher -> set ( $ name , array ( $ this , '_' . $ name ) ) ; } // Default configuration settings $ this -> set ( 'flight.base_url' , null ) ; $ this -> set ( 'flight.case_sensitive' , false ) ; $ this -> set ( 'flight.handle_errors' , true ) ; $ this -> set ( 'flight.log_errors' , false ) ; $ this -> set ( 'flight.views.path' , './views' ) ; $ this -> set ( 'flight.views.extension' , '.php' ) ; // Startup configuration $ this -> before ( 'start' , function ( ) use ( $ self ) { // Enable error handling if ( $ self -> get ( 'flight.handle_errors' ) ) { set_error_handler ( array ( $ self , 'handleError' ) ) ; set_exception_handler ( array ( $ self , 'handleException' ) ) ; } // Set case-sensitivity $ self -> router ( ) -> case_sensitive = $ self -> get ( 'flight.case_sensitive' ) ; } ) ; $ initialized = true ; }
Initializes the framework.
Initializes the framework .