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

Response   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 50%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
c 2
b 1
f 0
lcom 1
cbo 3
dl 0
loc 26
ccs 2
cts 4
cp 0.5
rs 10

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
 */
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