Completed
Push — master ( 79d24d...ad8160 )
by Thomas Mauro
03:36
created

AbstractServiceBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 2
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setHttpClient() 0 4 1
A setRequestFactory() 0 4 1
A getHttpClient() 0 4 1
A getRequestFactory() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\OpenIDClient\Service\Builder;
6
7
use Http\Discovery\Psr17FactoryDiscovery;
8
use Http\Discovery\Psr18ClientDiscovery;
9
use Psr\Http\Client\ClientInterface;
10
use Psr\Http\Message\RequestFactoryInterface;
11
12
abstract class AbstractServiceBuilder
13
{
14
    /** @var null|ClientInterface */
15
    private $httpClient;
16
17
    /** @var null|RequestFactoryInterface */
18
    private $requestFactory;
19
20
    public function setHttpClient(ClientInterface $httpClient): void
21
    {
22
        $this->httpClient = $httpClient;
23
    }
24
25
    public function setRequestFactory(RequestFactoryInterface $requestFactory): void
26
    {
27
        $this->requestFactory = $requestFactory;
28
    }
29
30
    protected function getHttpClient(): ClientInterface
31
    {
32
        return $this->httpClient = $this->httpClient ?? Psr18ClientDiscovery::find();
33
    }
34
35
    protected function getRequestFactory(): RequestFactoryInterface
36
    {
37
        return $this->requestFactory = $this->requestFactory ?? Psr17FactoryDiscovery::findRequestFactory();
38
    }
39
}
40