1 | <?php |
||
2 | /** |
||
3 | * ActiveRecord for API |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/yii2-hiart |
||
6 | * @package yii2-hiart |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hiqdev\hiart\rest; |
||
12 | |||
13 | use hiqdev\hiart\ResponseInterface; |
||
14 | |||
15 | class Connection extends \hiqdev\hiart\AbstractConnection |
||
16 | { |
||
17 | public $queryBuilderClass = QueryBuilder::class; |
||
18 | |||
19 | /** |
||
20 | * Method checks whether the response is an error. |
||
21 | * |
||
22 | * @param ResponseInterface $response |
||
23 | * @return false|string the error text or boolean `false`, when the response is not an error |
||
24 | */ |
||
25 | 2 | public function getResponseError(ResponseInterface $response) |
|
26 | { |
||
27 | 2 | $code = $response->getStatusCode(); |
|
28 | 2 | if ($code >= 200 && $code < 300) { |
|
29 | 2 | return false; |
|
30 | } |
||
31 | |||
32 | return $response->getReasonPhrase(); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
33 | } |
||
34 | } |
||
35 |