public function getErrorFunction($errorCode) { $closure = $this->getConfig(["errors", $errorCode], function () use($errorCode) { $response = new Response(); $response->setBody('<!DOCTYPE html> <html lang="ru"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <header> <h1>Error</h1> </header> </body>'); $response->setCode($errorCode); $response->sendReplay(); }); if ($closure instanceof Config) { $closure = $closure->toArray(); } return $closure; }