EmptyResponseHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 1
b 0
f 0
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