Completed
Push — master ( 03f6a6...3bcdeb )
by smiley
02:53
created

HTTPClientAbstract::request()   B

Complexity

Conditions 9
Paths 16

Size

Total Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 9
nc 16
nop 5
dl 0
loc 34
rs 8.0555
c 0
b 0
f 0
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\HTTP\HTTPOptions
28
	 */
29
	protected $options;
30
31
	/**
32
	 * @var \Psr\Http\Message\ResponseFactoryInterface
33
	 */
34
	protected $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