Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | final class RequestFailed extends \RuntimeException implements ClientException |
||
21 | { |
||
22 | /** @var Error|null */ |
||
23 | private $error; |
||
24 | |||
25 | 24 | public function getError() : ?Error |
|
28 | } |
||
29 | |||
30 | 112 | public static function fromErrorResponse(Response $response) : self |
|
31 | { |
||
32 | 112 | $self = new self( |
|
33 | 112 | $response->getBodyField(Keys::ERROR_24), |
|
34 | 112 | $response->getCode() & (Response::TYPE_ERROR - 1) |
|
35 | 112 | ); |
|
36 | |||
37 | 112 | if ($error = $response->tryGetBodyField(Keys::ERROR)) { |
|
38 | 112 | $self->error = Error::fromMap($error); |
|
39 | } |
||
40 | |||
41 | 112 | return $self; |
|
42 | } |
||
43 | |||
44 | 8 | public static function unknownSpace(string $spaceName) : self |
|
47 | } |
||
48 | |||
49 | 8 | public static function unknownIndex(string $indexName, int $spaceId) : self |
|
52 | } |
||
53 | } |
||
54 |