Completed
Pull Request — master (#1)
by Woody
27:07 queued 01:07
created

DiactorosConfiguration::apply()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1
Metric Value
dl 0
loc 27
ccs 14
cts 14
cp 1
rs 8.8571
cc 1
eloc 13
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Equip\Configuration;
4
5
use Auryn\Injector;
6
7
class DiactorosConfiguration implements ConfigurationInterface
8
{
9
    /**
10
     * @inheritDoc
11
     */
12 3
    public function apply(Injector $injector)
13
    {
14 3
        $injector->alias(
15 3
            'Psr\Http\Message\RequestInterface',
16
            // It should not be necessary to force all requests to be server
17
            // requests, except that Relay uses the wrong type hint:
18
            // https://github.com/relayphp/Relay.Relay/issues/25
19
            //
20
            // 'Zend\Diactoros\Request'
21 3
            'Zend\Diactoros\ServerRequest'
22
        );
23
24 3
        $injector->alias(
25 3
            'Psr\Http\Message\ResponseInterface',
26 3
            'Zend\Diactoros\Response'
27
        );
28
29 3
        $injector->alias(
30 3
            'Psr\Http\Message\ServerRequestInterface',
31 3
            'Zend\Diactoros\ServerRequest'
32
        );
33
34 3
        $injector->delegate(
35 3
            'Zend\Diactoros\ServerRequest',
36 3
            'Zend\Diactoros\ServerRequestFactory::fromGlobals'
37
        );
38 3
    }
39
}
40