コード例 #1
0
ファイル: App.php プロジェクト: ionutmilica/ionix-framework
 /**
  * Run the application
  */
 public function run()
 {
     $request = Request::createFromGlobals();
     $this->instance('request', $request);
     $this->bootProviders();
     $response = $this['router']->dispatch($this['request']);
     if (false == $response instanceof Response) {
         $response = new Response($response);
     }
     $response->send();
 }
コード例 #2
0
 public function testRequestMethod()
 {
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $request = Request::createFromGlobals();
     $this->assertEquals('POST', $request->getMethod());
 }
コード例 #3
0
 /**
  * For a specific method and uri, dispatch the route.
  *
  * @param Request $request
  * @return bool
  * @throws \Exception
  */
 public function dispatch(Request $request)
 {
     $pathInfo = $request->getPathInfo();
     $method = $request->getMethod();
     $route = $this->collection->find($method, $pathInfo);
     if (!$route) {
         throw new \Exception('Route not found !');
     }
     return $this->dispatcher->dispatch($route);
 }