src/core.php
function serve(array $urls)
	{
        $_SESSION['toto'] = 'prout';
        $response = null;

        // Registering PHP error handlers.
        set_error_handler(array($this, 'php_error_handler'), E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR);

        try {
            $handler = $this->route($urls);
            $response = $this->process($handler);
            $this->display($response);
        }
        catch(HttpRedirect $r) {
            $response = Injector::give('Response');
            $response->setHeader('Location', $r->getUrl());
        }
        catch(HTTPClientError $e) {
            $response = call_user_func($this->error40x, $e);
        }
        catch(HTTPServerError $e) {
            $response = call_user_func($this->error50x, $e);
        }
        // Generic HTTP status response.
        catch(HTTPStatus $s) {
            $response = Injector::give('Response', $s->getMessage(), $s->getCode());
        }
        // Generic error.
        catch(\Exception $e) {
            $response = call_user_func($this->error50x, $e);
        }
	}
function serve(array $urls)
	{
        $_SESSION['toto'] = 'prout';
        $response = null;

        // Registering PHP error handlers.
        set_error_handler(array($this, 'php_error_handler'), E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR);

        try {
            $handler = $this->route($urls);
            $response = $this->process($handler);
            $this->display($response);
        }
        catch(HttpRedirect $r) {
            $response = Injector::give('Response');
            $response->setHeader('Location', $r->getUrl());
        }
        catch(HTTPClientError $e) {
            $response = call_user_func($this->error40x, $e);
        }
        catch(HTTPServerError $e) {
            $response = call_user_func($this->error50x, $e);
        }
        // Generic HTTP status response.
        catch(HTTPStatus $s) {
            $response = Injector::give('Response', $s->getMessage(), $s->getCode());
        }
        // Generic error.
        catch(\Exception $e) {
            $response = call_user_func($this->error50x, $e);
        }
	}
function serve ( array $ urls ) { $ _SESSION [ 'toto' ] = 'prout' ; $ response = null ; // Registering PHP error handlers. set_error_handler ( array ( $ this , 'php_error_handler' ) , E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR ) ; try { $ handler = $ this -> route ( $ urls ) ; $ response = $ this -> process ( $ handler ) ; $ this -> display ( $ response ) ; } catch ( HttpRedirect $ r ) { $ response = Injector :: give ( 'Response' ) ; $ response -> setHeader ( 'Location' , $ r -> getUrl ( ) ) ; } catch ( HTTPClientError $ e ) { $ response = call_user_func ( $ this -> error40x , $ e ) ; } catch ( HTTPServerError $ e ) { $ response = call_user_func ( $ this -> error50x , $ e ) ; } // Generic HTTP status response. catch ( HTTPStatus $ s ) { $ response = Injector :: give ( 'Response' , $ s -> getMessage ( ) , $ s -> getCode ( ) ) ; } // Generic error. catch ( \ Exception $ e ) { $ response = call_user_func ( $ this -> error50x , $ e ) ; } }
Serves the requests.
@param array $urls is an associative arrays of regexes and
callbacks for routing.
Serves the requests .