public function send()
    {
        if (php_sapi_name() == 'cli') {
            return true;
        }

        // We add of the X-Powered-By header when disable_x_powered_by is true
        if (!$this->disable_x_powered_by) {
            $this->response->addHeader('X-Powered-By', 'Bow Framework');
        }

        $this->prefix = '';

        $method = $this->request->method();

        // We verify the existence of a special method DELETE, PUT
        if ($method == 'POST') {
            if ($this->special_method !== null) {
                $method = $this->special_method;
            }
        }

        // We verify the existence of the method of the request in
        // the routing collection
        if (!isset($this->routes[$method])) {
            // We verify and call function associate by 404 code
            $this->response->status(404);

            if (empty($this->error_code)) {
                $this->response->send(
                    sprintf('Cannot %s %s 404', $method, $this->request->path())
                );
            }

            return false;
        }

        $response = null;

        $error = true;

        foreach ($this->routes[$method] as $key => $route) {
            // The route must be an instance of Route
            if (!($route instanceof Route)) {
                continue;
            }

            // We launch the search of the method that arrived in the query
             // then start checking the url of the request
            if (!$route->match($this->request->path())) {
                continue;
            }

            $this->current['path'] = $route->getPath();

            // We call the action associate with the route
            $response = $route->call();
            $error = false;

            break;
        }

        // Error management
        if (!$error) {
            return $this->sendResponse($response);
        }

        // We apply the 404 error code
        $this->response->status(404);

        if (array_key_exists(404, $this->error_code)) {
            $response = Actionner::execute($this->error_code[404], []);

            return $this->sendResponse($response);
        }

        if (is_string($this->config['view.404'])) {
            $response = $this->response->render($this->config['view.404']);

            return $this->sendResponse($response);
        }

        throw new RouterException(
            sprintf('La route "%s" n\'existe pas', $this->request->path()),
            E_ERROR
        );
    }
public function send()
    {
        if (php_sapi_name() == 'cli') {
            return true;
        }

        // We add of the X-Powered-By header when disable_x_powered_by is true
        if (!$this->disable_x_powered_by) {
            $this->response->addHeader('X-Powered-By', 'Bow Framework');
        }

        $this->prefix = '';

        $method = $this->request->method();

        // We verify the existence of a special method DELETE, PUT
        if ($method == 'POST') {
            if ($this->special_method !== null) {
                $method = $this->special_method;
            }
        }

        // We verify the existence of the method of the request in
        // the routing collection
        if (!isset($this->routes[$method])) {
            // We verify and call function associate by 404 code
            $this->response->status(404);

            if (empty($this->error_code)) {
                $this->response->send(
                    sprintf('Cannot %s %s 404', $method, $this->request->path())
                );
            }

            return false;
        }

        $response = null;

        $error = true;

        foreach ($this->routes[$method] as $key => $route) {
            // The route must be an instance of Route
            if (!($route instanceof Route)) {
                continue;
            }

            // We launch the search of the method that arrived in the query
             // then start checking the url of the request
            if (!$route->match($this->request->path())) {
                continue;
            }

            $this->current['path'] = $route->getPath();

            // We call the action associate with the route
            $response = $route->call();
            $error = false;

            break;
        }

        // Error management
        if (!$error) {
            return $this->sendResponse($response);
        }

        // We apply the 404 error code
        $this->response->status(404);

        if (array_key_exists(404, $this->error_code)) {
            $response = Actionner::execute($this->error_code[404], []);

            return $this->sendResponse($response);
        }

        if (is_string($this->config['view.404'])) {
            $response = $this->response->render($this->config['view.404']);

            return $this->sendResponse($response);
        }

        throw new RouterException(
            sprintf('La route "%s" n\'existe pas', $this->request->path()),
            E_ERROR
        );
    }
public function send ( ) { if ( php_sapi_name ( ) == 'cli' ) { return true ; } // We add of the X-Powered-By header when disable_x_powered_by is true if ( ! $ this -> disable_x_powered_by ) { $ this -> response -> addHeader ( 'X-Powered-By' , 'Bow Framework' ) ; } $ this -> prefix = '' ; $ method = $ this -> request -> method ( ) ; // We verify the existence of a special method DELETE, PUT if ( $ method == 'POST' ) { if ( $ this -> special_method !== null ) { $ method = $ this -> special_method ; } } // We verify the existence of the method of the request in // the routing collection if ( ! isset ( $ this -> routes [ $ method ] ) ) { // We verify and call function associate by 404 code $ this -> response -> status ( 404 ) ; if ( empty ( $ this -> error_code ) ) { $ this -> response -> send ( sprintf ( 'Cannot %s %s 404' , $ method , $ this -> request -> path ( ) ) ) ; } return false ; } $ response = null ; $ error = true ; foreach ( $ this -> routes [ $ method ] as $ key => $ route ) { // The route must be an instance of Route if ( ! ( $ route instanceof Route ) ) { continue ; } // We launch the search of the method that arrived in the query // then start checking the url of the request if ( ! $ route -> match ( $ this -> request -> path ( ) ) ) { continue ; } $ this -> current [ 'path' ] = $ route -> getPath ( ) ; // We call the action associate with the route $ response = $ route -> call ( ) ; $ error = false ; break ; } // Error management if ( ! $ error ) { return $ this -> sendResponse ( $ response ) ; } // We apply the 404 error code $ this -> response -> status ( 404 ) ; if ( array_key_exists ( 404 , $ this -> error_code ) ) { $ response = Actionner :: execute ( $ this -> error_code [ 404 ] , [ ] ) ; return $ this -> sendResponse ( $ response ) ; } if ( is_string ( $ this -> config [ 'view.404' ] ) ) { $ response = $ this -> response -> render ( $ this -> config [ 'view.404' ] ) ; return $ this -> sendResponse ( $ response ) ; } throw new RouterException ( sprintf ( 'La route "%s" n\'existe pas' , $ this -> request -> path ( ) ) , E_ERROR ) ; }
Launcher of the application

@return mixed
@throws RouterException
Launcher of the application