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

EmptyResponseHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 2 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
	protected ResponseFactoryInterface $responseFactory;
21
22
	protected int $status;
23
24
	/**
25
	 * EmptyResponseHandler constructor.
26
	 */
27
	public function __construct(ResponseFactoryInterface $responseFactory, int $status){
28
		$this->responseFactory = $responseFactory;
29
		$this->status          = $status;
30
	}
31
32
	/**
33
	 * @inheritDoc
34
	 */
35
	public function handle(ServerRequestInterface $request):ResponseInterface{
36
		return $this->responseFactory->createResponse($this->status);
37
	}
38
39
}
40