Response::__call()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * Guzzle transport for yii2-hiart
4
 *
5
 * @link      https://github.com/hiqdev/yii2-hiart-guzzle
6
 * @package   yii2-hiart-guzzle
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\hiart\guzzle;
12
13
use Psr\Http\Message\ResponseInterface as Worker;
14
15
/**
16
 * Guzzle response implementation.
17
 *
18
 * @author Andrii Vasyliev <[email protected]>
19
 * @method \Psr\Http\Message\ResponseInterface getWorker()
20
 */
21
class Response extends \hiqdev\hiart\proxy\Response
22
{
23
    /**
24
     * @var Worker
25
     */
26
    protected $worker;
27
28
    /**
29
     * @var string
30
     */
31
    protected $rawData;
32
33 2
    public function getRawData()
34
    {
35 2
        if ($this->rawData === null) {
36 2
            $this->rawData = $this->worker->getBody()->getContents();
37 2
        }
38
39 2
        return $this->rawData;
40
    }
41
42
    public function __call($name, $args)
43
    {
44
        return call_user_func_array([$this->worker, $name], $args);
45
    }
46
}
47