ResponseDecodingException::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
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;
12
13
class ResponseDecodingException extends ResponseErrorException
14
{
15
    /**
16
     * @return mixed
17
     */
18
    public function getName()
19
    {
20
        return 'Failed to decode the response';
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function getErrorInfo()
27
    {
28
        $request = $this->getRequest();
29
        $response = $this->getResponse();
30
31
        return [
32
            'statusCode' => $response->getStatusCode(),
33
            'data' => $response->getRawData(),
34
            'headers' => $response->getHeaders(),
35
            'request' => [
36
                'method' => $request->getMethod(),
37
                'uri' => $request->getFullUri(),
38
                'body' => $request->getBody(),
39
            ],
40
        ];
41
    }
42
}
43