Request   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 23
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createWorker() 0 4 1
A prepareHandlerConfig() 0 6 1
A isSupported() 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 GuzzleHttp\Client as Handler;
14
use GuzzleHttp\Psr7\Request as Worker;
15
16
/**
17
 * Guzzle request implementation.
18
 *
19
 * @author Andrii Vasyliev <[email protected]>
20
 */
21
class Request extends \hiqdev\hiart\proxy\Request
22
{
23
    protected $responseClass = Response::class;
24
25
    protected $handlerClass = Handler::class;
26
27 2
    protected function createWorker()
28
    {
29 2
        return new Worker($this->method, $this->uri, $this->headers, $this->body, $this->version);
0 ignored issues
show
Documentation introduced by
$this->method is of type array, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
30
    }
31
32 2
    protected function prepareHandlerConfig($config)
33
    {
34 2
        return array_merge([
35 2
            'base_uri' => $this->getDb()->getBaseUri(),
36 2
        ], $config);
37
    }
38
39
    public static function isSupported()
40
    {
41
        return true;
42
    }
43
}
44