ServerRequestFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 21
ccs 2
cts 2
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createServerRequest() 0 3 1
1
<?php
2
3
namespace DMT\Aura\Psr\Factory;
4
5
use DMT\Aura\Psr\Message\ServerRequest;
6
use Psr\Http\Message\ServerRequestFactoryInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Message\UriInterface;
9
10
/**
11
 * Class ServerRequestFactory
12
 *
13
 * @package DMT\Aura\Psr\Factory
14
 */
15
class ServerRequestFactory implements ServerRequestFactoryInterface
16
{
17
    /**
18
     * Create a new server request.
19
     *
20
     * Note that server-params are taken precisely as given - no parsing/processing
21
     * of the given values is performed, and, in particular, no attempt is made to
22
     * determine the HTTP method or URI, which must be provided explicitly.
23
     *
24
     * @param string $method The HTTP method associated with the request.
25
     * @param UriInterface|string $uri The URI associated with the request. If
26
     *     the value is a string, the factory MUST create a UriInterface
27
     *     instance based on it.
28
     * @param array $serverParams Array of SAPI parameters with which to seed
29
     *     the generated request instance.
30
     *
31
     * @return ServerRequest|ServerRequestInterface
32
     */
33 16
    public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
34
    {
35 16
        return new ServerRequest($method, $uri, $serverParams);
36
    }
37
}
38