1 | <?php |
||
9 | class Response |
||
10 | { |
||
11 | /** |
||
12 | * The Aythy response body content as array. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $body; |
||
17 | |||
18 | /** |
||
19 | * The Aythy response status code. |
||
20 | * |
||
21 | * @var int |
||
22 | */ |
||
23 | protected $status; |
||
24 | |||
25 | /** |
||
26 | * Create a new Authy response instance. |
||
27 | * |
||
28 | * @param \Psr\Http\Message\ResponseInterface $httpResponse |
||
29 | */ |
||
30 | public function __construct(ResponseInterface $httpResponse) |
||
35 | |||
36 | /** |
||
37 | * Get Authy response status code. |
||
38 | * |
||
39 | * @return int |
||
40 | */ |
||
41 | public function statusCode(): int |
||
45 | |||
46 | /** |
||
47 | * Get Authy response body item. |
||
48 | * |
||
49 | * @param string $var |
||
50 | * |
||
51 | * @return mixed |
||
52 | */ |
||
53 | public function get($var) |
||
57 | |||
58 | /** |
||
59 | * Get Authy response body message. |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function message(): string |
||
67 | |||
68 | /** |
||
69 | * Determine if the Authy response succeed. |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function succeed(): bool |
||
77 | |||
78 | /** |
||
79 | * Determine if the Authy response failed. |
||
80 | * |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function failed(): bool |
||
87 | |||
88 | /** |
||
89 | * Get Authy response errors. |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | public function errors(): array |
||
99 | |||
100 | /** |
||
101 | * Determine if the given result is success. |
||
102 | * |
||
103 | * @param mixed $result |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | protected function isSuccess($result): bool |
||
111 | } |
||
112 |