logger()->warning($throwable->getMessage()." on ".$throwable->getFile().":".$throwable->getLine(), $data); } /** * @param Throwable $throwable * @param array $data * @return void */ public function logError(Throwable $throwable, array $data = []) : void { $this->logger()->error($throwable->getMessage()." on ".$throwable->getFile().":".$throwable->getLine(), $data); } /** * @param string $name * @param string $value * @return void */ public function addHeader(string $name, string $value) : void { $this->globals()->addHeader($name, $value); } /** * @param $html * @param int $status * @param array $headers * @return ResponseInterface */ public function htmlResponse($html, int $status = 200, array $headers = []) : ResponseInterface { return new HtmlResponse($html, $status, array_merge($this->globals()->response()->getHeaders(), $headers)); } /** * @param $text * @param int $status * @param array $headers * @return ResponseInterface */ public function textResponse($text, int $status = 200, array $headers = []) : ResponseInterface { return new TextResponse($text, $status, array_merge($this->globals()->response()->getHeaders(), $headers)); } /** * @param array $array * @param int $status * @param array $headers * @return ResponseInterface */ public function jsonResponse(array $array, int $status = 200, array $headers = []) : ResponseInterface { return new JsonResponse($array, $status, array_merge($this->globals()->response()->getHeaders(), $headers), JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT); } }