Completed
Push — master ( 78d4e7...979ecb )
by smiley
02:57
created

ResponseFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createResponse() 0 3 1
1
<?php
2
/**
3
 * Class ResponseFactory
4
 *
5
 * @filesource   ResponseFactory.php
6
 * @created      27.08.2018
7
 * @package      chillerlan\HTTP\Psr17
8
 * @author       smiley <[email protected]>
9
 * @copyright    2018 smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\HTTP\Psr17;
14
15
use chillerlan\HTTP\Psr7\Response;
16
use Fig\Http\Message\StatusCodeInterface;
17
use Psr\Http\Message\{ResponseFactoryInterface, ResponseInterface};
18
19
final class ResponseFactory implements ResponseFactoryInterface, StatusCodeInterface{
20
21
	/**
22
	 * Create a new response.
23
	 *
24
	 * @param int    $code         HTTP status code; defaults to 200
25
	 * @param string $reasonPhrase Reason phrase to associate with status code
26
	 *                             in generated response; if none is provided implementations MAY use
27
	 *                             the defaults as suggested in the HTTP specification.
28
	 *
29
	 * @return \Psr\Http\Message\ResponseInterface|\chillerlan\HTTP\Psr7\Response
30
	 */
31
	public function createResponse(int $code = 200, string $reasonPhrase = ''):ResponseInterface{
32
		return new Response($code, null, null, null, $reasonPhrase);
33
	}
34
35
}
36