ServerRequestFactory::createServerRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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