Completed
Push — master ( 723741...e2f01d )
by smiley
02:37
created

EmptyResponseHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 $responseFactory;
24
25
	/**
26
	 * @var int
27
	 */
28
	protected $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