Passed
Push — gh-pages ( 22b0fe...eb2d91 )
by
unknown
12:27 queued 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
 * @created      09.03.2019
6
 * @author       smiley <[email protected]>
7
 * @copyright    2019 smiley
8
 * @license      MIT
9
 */
10
11
namespace chillerlan\HTTP\Psr15;
12
13
use Psr\Http\Message\{ResponseFactoryInterface, ResponseInterface, ServerRequestInterface};
14
use Psr\Http\Server\RequestHandlerInterface;
15
16
class EmptyResponseHandler implements RequestHandlerInterface{
17
18
	protected ResponseFactoryInterface $responseFactory;
19
20
	protected int $status;
21
22
	/**
23
	 * EmptyResponseHandler constructor.
24
	 */
25
	public function __construct(ResponseFactoryInterface $responseFactory, int $status){
26
		$this->responseFactory = $responseFactory;
27
		$this->status          = $status;
28
	}
29
30
	/**
31
	 * @inheritDoc
32
	 */
33
	public function handle(ServerRequestInterface $request):ResponseInterface{
34
		return $this->responseFactory->createResponse($this->status);
35
	}
36
37
}
38