Exemplo n.º 1
0
 public function run()
 {
     foreach ($this->providers as $provider) {
         $provider->boot();
     }
     $request = Http\Request::createFromGlobals();
     $response = $this['Api\\RequestHandler']->handle($request);
     $response->send();
 }
Exemplo n.º 2
0
 public function boot()
 {
     Request::setAcceptParser($this->app['Sunel\\Api\\Http\\Parser\\Accept']);
 }
Exemplo n.º 3
0
 /**
  * Attempt to parse the token from query
  *
  * @param  \Illuminate\Http\Request  $request
  *
  * @return null|string
  */
 protected function fromQuery(Request $request)
 {
     return $request->query($this->key);
 }
Exemplo n.º 4
0
 /**
  * Get the URI, methods, and action from the route.
  *
  * @param mixed                    $route
  * @param \Sunel\Api\Http\Request $request
  *
  * @return array
  */
 public function getRouteProperties($route, Request $request)
 {
     $uri = ltrim(isset($route['uri']) ? $route['uri'] : $request->getRequestUri(), '/');
     $methods = isset($route['methods']) ? $route['methods'] : (array) $request->getMethod();
     $action = isset($route[1]) && is_array($route[1]) ? $route[1] : $route;
     if ($request->getMethod() === 'GET' && !in_array('HEAD', $methods)) {
         $methods[] = 'HEAD';
     }
     return [$uri, $methods, $action];
 }