Response   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 26
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRawData() 0 8 2
A __call() 0 4 1
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