Example #1
0
 public static function getHandler()
 {
     return function () {
         $app = Deal::getInstance();
         $app->halt(404, 'Endpoint not found.');
     };
 }
Example #2
0
File: Json.php Project: dwsla/deal
 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);
 }
Example #3
0
File: Error.php Project: dwsla/deal
 public static function getHandler()
 {
     return function (\Exception $e) {
         Deal::getInstance()->halt(500, $e->getMessage() . ' - ' . $e->getTraceAsString());
     };
 }
Example #4
0
File: Deal.php Project: dwsla/deal
 public function loadCustomRoutes()
 {
     $this->get('/', Deal::getAuthMiddleware($this), function () {
         Deal::getInstance()->halt('200', 'ok');
     });
 }