1 | <?php |
||
20 | class Response |
||
21 | { |
||
22 | /** |
||
23 | * The raw Http response instance. |
||
24 | * |
||
25 | * @var \Psr\Http\Message\ResponseInterface |
||
26 | */ |
||
27 | protected $httpResponse; |
||
28 | |||
29 | /** |
||
30 | * Create a new Authy response instance. |
||
31 | * |
||
32 | * @param \Psr\Http\Message\ResponseInterface $httpResponse |
||
33 | */ |
||
34 | public function __construct(ResponseInterface $httpResponse) |
||
38 | |||
39 | /** |
||
40 | * Get Authy response status code. |
||
41 | * |
||
42 | * @return int |
||
43 | */ |
||
44 | public function statusCode() |
||
48 | |||
49 | /** |
||
50 | * Return Authy response body as array. |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | public function body() |
||
58 | |||
59 | /** |
||
60 | * Get Authy response body item. |
||
61 | * |
||
62 | * @param string $var |
||
63 | * |
||
64 | * @return mixed |
||
65 | */ |
||
66 | public function get($var) |
||
72 | |||
73 | /** |
||
74 | * Get Authy response body message. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function message() |
||
82 | |||
83 | /** |
||
84 | * Determine if the Authy response succeed. |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | public function succeed() |
||
92 | |||
93 | /** |
||
94 | * Determine if the Authy response failed. |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function failed() |
||
102 | |||
103 | /** |
||
104 | * Get Authy response errors. |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | public function errors() |
||
114 | |||
115 | /** |
||
116 | * Determine if the given result is success. |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | protected function isSuccess($result) |
||
124 | } |
||
125 |