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

EmptyResponseHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1
1
<?php
2
/**
3
 * Class EmptyResponseHandler
4
 *
5
 * @filesource   EmptyResponseHandler.php
6
 * @created      09.03.2019
7
 * @package      chillerlan\HTTP\Psr15
8
 * @author       smiley <[email protected]>
9
 * @copyright    2019 smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\HTTP\Psr15;
14
15
use Psr\Http\Message\{ResponseFactoryInterface, ResponseInterface, ServerRequestInterface};
16
use Psr\Http\Server\RequestHandlerInterface;
17
18
class EmptyResponseHandler implements RequestHandlerInterface{
19
20
	/**
21
	 * @var \Psr\Http\Message\ResponseFactoryInterface
22
	 */
23
	protected ResponseFactoryInterface $responseFactory;
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...
24
25
	/**
26
	 * @var int
27
	 */
28
	protected int $status;
29
30
	/**
31
	 * EmptyResponseHandler constructor.
32
	 *
33
	 * @param \Psr\Http\Message\ResponseFactoryInterface $responseFactory
34
	 * @param int                                        $status
35
	 */
36
	public function __construct(ResponseFactoryInterface $responseFactory, int $status){
37
		$this->responseFactory = $responseFactory;
38
		$this->status          = $status;
39
	}
40
41
	/**
42
	 * @inheritDoc
43
	 */
44
	public function handle(ServerRequestInterface $request):ResponseInterface{
45
		return $this->responseFactory->createResponse($this->status);
46
	}
47
48
}
49