Ejemplo n.º 1
0
 private function resolveHttpResponse(Request\HttpInterface $request)
 {
     if (isset($this->suffixes[$suffix = $request->getUri()->getSuffix()])) {
         $type = $this->suffixes[$suffix];
     } elseif (isset($this->types[$type = $request->accepts(array_keys($this->types))])) {
         $type = $this->types[$type];
     } else {
         $type = $this->fallback;
     }
     $response = new Response\Http();
     if ($type) {
         $response->setHeader('Content-Type', $type);
     }
     return $response;
 }
Ejemplo n.º 2
0
 private static function translateHttp(HttpInterface $request)
 {
     return $request->getMethod() . ' ' . $request->getUri()->getRequest();
 }