1 | <?php |
||
22 | class Response |
||
23 | { |
||
24 | /** |
||
25 | * The Aythy response body content as array. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $body; |
||
30 | |||
31 | /** |
||
32 | * The Aythy response status code. |
||
33 | * |
||
34 | * @var int |
||
35 | */ |
||
36 | protected $status; |
||
37 | |||
38 | /** |
||
39 | * Create a new Authy response instance. |
||
40 | * |
||
41 | * @param \Psr\Http\Message\ResponseInterface $httpResponse |
||
42 | */ |
||
43 | public function __construct(ResponseInterface $httpResponse) |
||
48 | |||
49 | /** |
||
50 | * Get Authy response status code. |
||
51 | * |
||
52 | * @return int |
||
53 | */ |
||
54 | public function statusCode(): int |
||
58 | |||
59 | /** |
||
60 | * Get Authy response body item. |
||
61 | * |
||
62 | * @param string $var |
||
63 | * |
||
64 | * @return mixed |
||
65 | */ |
||
66 | public function get($var) |
||
70 | |||
71 | /** |
||
72 | * Get Authy response body message. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function message() |
||
80 | |||
81 | /** |
||
82 | * Determine if the Authy response succeed. |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | public function succeed(): bool |
||
90 | |||
91 | /** |
||
92 | * Determine if the Authy response failed. |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | public function failed(): bool |
||
100 | |||
101 | /** |
||
102 | * Get Authy response errors. |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | public function errors() |
||
112 | |||
113 | /** |
||
114 | * Determine if the given result is success. |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | protected function isSuccess($result): bool |
||
122 | } |
||
123 |