Failed Conditions
Pull Request — master (#28)
by Maximo
03:29
created

RequestProvider::register()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Providers;
6
7
use Gewaer\Http\Request;
8
use Gewaer\Http\SwooleRequest;
9
use Phalcon\Di\ServiceProviderInterface;
10
use Phalcon\DiInterface;
11
use function Gewaer\Core\isSwooleServer;
12
13
class RequestProvider implements ServiceProviderInterface
14
{
15
    /**
16
     * @param DiInterface $container
17
     */
18 40
    public function register(DiInterface $container)
19
    {
20 40
        if (isSwooleServer()) {
21
            $container->setShared('request', new SwooleRequest());
22
        } else {
23 40
            $container->setShared('request', new Request());
24
        }
25 40
    }
26
}
27