Recca0120\LaravelTracy\Debugbar::render PHP Method

render() public method

render.
public render ( Response $response ) : Response
$response Symfony\Component\HttpFoundation\Response
return Symfony\Component\HttpFoundation\Response
    public function render(Response $response)
    {
        if ($this->showBar === false) {
            return $response;
        }
        $statusCode = $response->getStatusCode();
        if ($this->deny($response, $statusCode) === true) {
            return $response;
        }
        $content = $response->getContent();
        $htmlValidatorPanel = $this->getPanel('html-validator');
        if (is_null($htmlValidatorPanel) === false && $statusCode === 200) {
            $htmlValidatorPanel->setHtml($content);
        }
        $bar = $this->getBar();
        $pos = strripos($content, '</body>');
        if ($pos !== false) {
            $content = substr($content, 0, $pos) . $bar . substr($content, $pos);
        } else {
            $content .= $bar;
        }
        $response->setContent($content);
        return $response;
    }

Usage Example

Example #1
0
 /**
  * dispatchContent.
  *
  * @method dispatchContent
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function dispatchContent($request, $next)
 {
     $this->storeWrapper->start();
     $this->debugbar->dispatchContent();
     $response = $this->debugbar->render($next($request));
     $this->storeWrapper->store()->close();
     return $response;
 }
All Usage Examples Of Recca0120\LaravelTracy\Debugbar::render