コード例 #1
0
ファイル: ApiFacade.php プロジェクト: larapackage/api
 /**
  * @inheritdoc
  */
 private function error($statusCode, $message, \Exception $e, $headers = [])
 {
     $responseArray = ['error' => ['http_status' => $statusCode, 'message' => $message]];
     // Other than production, debug information will be included with
     // the returned query if an exception is thrown and caught by the handler
     $appEnv = getenv('APP_ENV');
     if ($appEnv and $appEnv !== 'production') {
         $responseArray['debug'] = $this->debug($e);
     }
     return $this->factory->makeRepresentationCreator()->make($responseArray, $statusCode, $headers);
 }
コード例 #2
0
ファイル: ApiFacadeSpec.php プロジェクト: larapackage/api
 protected function errorExpectations($statusCode, $message, Factory $factory, RepresentationCreator $representationCreator, Response $response, $headers = [])
 {
     $responseArray = ['error' => ['http_status' => $statusCode, 'message' => $message]];
     $factory->makeRepresentationCreator()->shouldBeCalled()->willReturn($representationCreator);
     $representationCreator->make($responseArray, $statusCode, $headers)->shouldBeCalled()->willReturn($response);
 }