Completed
Pull Request — master (#252)
by Oliver
12:09
created

AbstractRequestBuilder::getRequestFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Knp\FriendlyContexts\Builder;
4
5
use Http\Client\HttpClient;
6
use Http\Discovery\HttpClientDiscovery;
7
use Http\Message\RequestFactory;
8
9
abstract class AbstractRequestBuilder implements RequestBuilderInterface
10
{
11
    /**
12
     * @var RequestFactory
13
     */
14
    protected $requestFactory;
15
16
    /**
17
     * @var HttpClient
18
     */
19
    protected $client;
20
21
    /**
22
     * @param RequestFactory $requestFactory
23
     * @param HttpClient     $client
0 ignored issues
show
Documentation introduced by
Should the type for parameter $client not be null|HttpClient?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
24
     */
25
    public function __construct(RequestFactory $requestFactory, HttpClient $client = null)
26
    {
27
        $this->requestFactory = $requestFactory;
28
        $this->client = $client ?: HttpClientDiscovery::find();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
29
    }
30
31
    public function getRequestFactory()
32
    {
33
        return $this->requestFactory;
34
    }
35
36
    public function getClient()
37
    {
38
        return $this->client;
39
    }
40
}
41