dispatchAssets() public method

dispatchAssets.
public dispatchAssets ( ) : string
return string
Ejemplo n.º 1
0
 /**
  * dispatchAssets.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function dispatchAssets($request, $next)
 {
     $assets = $request->get('_tracy_bar');
     switch ($assets) {
         case 'css':
             $content = $this->debugbar->dispatchAssets();
             $headers = ['content-type' => 'text/css; charset=utf-8', 'cache-control' => 'max-age=86400'];
             break;
         case 'js':
         case 'assets':
             $content = $this->debugbar->dispatchAssets();
             $headers = ['content-type' => 'text/javascript; charset=utf-8', 'cache-control' => 'max-age=86400'];
             break;
         default:
             $this->storeWrapper->start();
             $this->storeWrapper->restore();
             $content = $this->debugbar->dispatchContent();
             $headers = ['content-type' => 'text/javascript; charset=utf-8'];
             $this->storeWrapper->clean($assets)->close();
             break;
     }
     return $this->responseFactory->make($content, 200, array_merge($headers, ['content-length' => strlen($content)]));
 }
Ejemplo n.º 2
0
 /**
  * handle.
  *
  * @method handle
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure $next
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle($request, $next)
 {
     if ($request->has('_tracy_bar') === true) {
         $tracyBar = $request->get('_tracy_bar');
         switch ($tracyBar) {
             case 'css':
                 $content = $this->debugbar->dispatchAssets();
                 $headers = ['content-type' => 'text/css; charset=utf-8', 'cache-control' => 'max-age=86400'];
                 break;
             case 'js':
             case 'assets':
                 $content = $this->debugbar->dispatchAssets();
                 $headers = ['content-type' => 'text/javascript; charset=utf-8', 'cache-control' => 'max-age=86400'];
                 break;
             default:
                 $content = $this->debugbar->dispatch();
                 $headers = ['content-type' => 'text/javascript; charset=utf-8'];
                 break;
         }
         return $this->sendStreamedResponse($content, array_merge($headers, ['content-length' => strlen($content)]));
     }
     $this->debugbar->dispatch();
     return $next($request);
 }