Completed
Push — master ( d04b3b...7686ca )
by Andrii
01:48
created

Response::getRawData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 2
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 6
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
 */
20
class Response extends \hiqdev\hiart\proxy\Response
21
{
22
    /**
23
     * @var Worker
24
     */
25
    protected $worker;
26
27 2
    /**
28
     * @var string
29 2
     */
30
    protected $rawData;
31
32
    public function getRawData()
33
    {
34
        if ($this->rawData === null) {
35
            $this->rawData = $this->worker->getBody()->getContents();
36
        }
37
38
        return $this-rawData;
39
    }
40
41
    public function __call($name, $args)
42
    {
43
        return call_user_func_array([$this->worker, $name], $args);
44
    }
45
}
46