コード例 #1
0
ファイル: Request.php プロジェクト: accepton/accepton-php
 /**
  * @throws AcceptOn\Error if the response failed (non-2xx response).
  *
  * @return mixed
  */
 private function throwOrReturnResponseBody($body, $statusCode)
 {
     $error = Error::fromResponse($body, $statusCode);
     if (isset($error)) {
         throw $error;
     }
     return json_decode($body);
 }
コード例 #2
0
ファイル: ErrorTest.php プロジェクト: accepton/accepton-php
 public function testNullForUnknownStatusCode()
 {
     $instance = Error::fromResponse("{}", 999);
     $this->assertNull($instance);
 }