public static function getHandler() { return function () { $app = Deal::getInstance(); $app->halt(404, 'Endpoint not found.'); }; }
public function call() { // Run inner middleware and application $this->next->call(); // Get reference to application $app = Deal::getInstance(); // set the content type $app->response()->header('Content-type', 'application/json'); $res = $app->response(); $body = $res->body(); // serialized? if (preg_match('/^([adObis]):/', $body)) { $body = unserialize($body); } if (is_scalar($body)) { $body = array('response' => $body); } $encode = json_encode($body, JSON_UNESCAPED_SLASHES); $app->response()->body($encode); }
public static function getHandler() { return function (\Exception $e) { Deal::getInstance()->halt(500, $e->getMessage() . ' - ' . $e->getTraceAsString()); }; }
public function loadCustomRoutes() { $this->get('/', Deal::getAuthMiddleware($this), function () { Deal::getInstance()->halt('200', 'ok'); }); }