Passed
Push — main ( f2efe3...53dc0a )
by smiley
10:15
created

HTTPClientAbstract   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 19
rs 10
c 2
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
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
	/** @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\HTTP\HTTPOptions */
27
	protected SettingsContainerInterface $options;
28
29
	protected ResponseFactoryInterface $responseFactory;
30
31
	/**
32
	 * HTTPClientAbstract constructor.
33
	 */
34
	public function __construct(
35
		SettingsContainerInterface $options = null,
36
		ResponseFactoryInterface $responseFactory = null,
37
		LoggerInterface $logger = null
38
	){
39
		$this->options         = $options ?? new HTTPOptions;
40
		$this->responseFactory = $responseFactory ?? new ResponseFactory;
41
		$this->logger          = $logger ?? new NullLogger;
42
	}
43
44
}
45