EmptyResponseHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 18
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
	protected int                      $status;
20
21
	/**
22
	 * EmptyResponseHandler constructor.
23
	 */
24
	public function __construct(ResponseFactoryInterface $responseFactory, int $status){
25
		$this->responseFactory = $responseFactory;
26
		$this->status          = $status;
27
	}
28
29
	/**
30
	 * @inheritDoc
31
	 */
32
	public function handle(ServerRequestInterface $request):ResponseInterface{
33
		return $this->responseFactory->createResponse($this->status);
34
	}
35
36
}
37