コード例 #1
0
 function filterResponse(ResponseInterface $response)
 {
     $printer = $this->getPrinter($this->getOutputType($response->getHeader('Content-Type')));
     $this->addDebugExecutionTime();
     $this->addDebugMemoryUsage();
     $response->setContent($printer->printDebug($this->debug, $response->getContent()));
     return $response;
 }
コード例 #2
0
 function renderFor($resource_name, ResponseInterface $response, RequestInterface $request)
 {
     $templates = $this->package_provider->getTemplatesFor($resource_name, $request);
     if (!$templates['template'] instanceof TemplateInterface) {
         $response->setStatus(406);
     } else {
         $response->setContent($this->renderer->renderTemplate($templates['template'], $response->getContent(), $templates['layout']));
         $response->setHeader('Content-Type', $templates['mime-type']);
     }
     return $response;
 }