Phprest\Application::run PHP Method

run() public method

Run the application
public run ( Request $request = null ) : string
$request Symfony\Component\HttpFoundation\Request
return string
    public function run(Request $request = null)
    {
        if (null === $request) {
            $request = Request::createFromGlobals();
        }
        $this->registerMiddleware('Phprest\\Middleware\\ApiVersion');
        $app = $this->stackBuilder->resolve($this);
        $response = $app->handle($request, self::MASTER_REQUEST, false);
        $response->send();
        $app->terminate($request, $response);
    }

Usage Example

示例#1
0
 /**
  * @expectedException \League\Route\Http\Exception\NotFoundException
  */
 public function testRunNotFound()
 {
     $this->app->run();
 }