/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); if ($this->isAResponseObject($response) && $this->isAnHtmlResponse($response)) { $output = $response->getContent(); $minified = $this->html->render($output); $response->setContent($minified); } return $response; }
/** * Get the minified response. * * @param mixed $response * * @return mixed */ public function live($response) { if ($this->isAResponseObject($response) && $this->isAnHtmlResponse($response)) { $output = $response->getContent(); $minified = $this->html->render($output); $response->setContent($minified); } return $response; }
/** * Get the minified html. * * @param string $value * * @return string */ public function html($value) { return $this->html->render($value); }