Completed
Push — master ( 4731c2...fd6e0c )
by Andrii
04:23
created

Response   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 66.67%

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 26
ccs 4
cts 6
cp 0.6667
rs 10
c 3
b 2
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
 */
20
class Response extends \hiqdev\hiart\proxy\Response
21
{
22
    /**
23
     * @var Worker
24
     */
25
    protected $worker;
26
27
    /**
28
     * @var string
29
     */
30
    protected $rawData;
31
32 2
    public function getRawData()
33
    {
34 2
        if ($this->rawData === null) {
35 2
            $this->rawData = $this->worker->getBody()->getContents();
36
        }
37
38 2
        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