Completed
Push — master ( 988ea9...868c80 )
by smiley
07:26
created

HTTPClientAbstract   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 4
1
<?php
2
/**
3
 * Class HTTPClientAbstract
4
 *
5
 * @filesource   HTTPClientAbstract.php
6
 * @created      22.02.2019
7
 * @package      chillerlan\HTTP\Psr18
8
 * @author       smiley <[email protected]>
9
 * @copyright    2019 smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\HTTP\Psr18;
14
15
use chillerlan\HTTP\HTTPOptions;
16
use chillerlan\HTTP\Psr17\{ResponseFactory};
17
use chillerlan\Settings\SettingsContainerInterface;
18
use Fig\Http\Message\RequestMethodInterface;
19
use Psr\Http\Client\ClientInterface;
20
use Psr\Http\Message\ResponseFactoryInterface;
21
use Psr\Log\{LoggerAwareInterface, LoggerAwareTrait, LoggerInterface, NullLogger};
22
23
abstract class HTTPClientAbstract implements ClientInterface, LoggerAwareInterface, RequestMethodInterface{
24
	use LoggerAwareTrait;
25
26
	/**
27
	 * @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\HTTP\HTTPOptions
28
	 */
29
	protected SettingsContainerInterface $options;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
30
31
	/**
32
	 * @var \Psr\Http\Message\ResponseFactoryInterface
33
	 */
34
	protected ResponseFactoryInterface $responseFactory;
35
36
	/**
37
	 * HTTPClientAbstract constructor.
38
	 *
39
	 * @param \chillerlan\Settings\SettingsContainerInterface|null $options
40
	 * @param \Psr\Http\Message\ResponseFactoryInterface|null      $responseFactory
41
	 * @param \Psr\Log\LoggerInterface|null                        $logger
42
	 */
43
	public function __construct(
44
		SettingsContainerInterface $options = null,
45
		ResponseFactoryInterface $responseFactory = null,
46
		LoggerInterface $logger = null
47
	){
48
		$this->options         = $options ?? new HTTPOptions;
49
		$this->responseFactory = $responseFactory ?? new ResponseFactory;
50
		$this->logger          = $logger ?? new NullLogger;
51
	}
52
53
}
54