Passed
Pull Request — master (#261)
by Wilmer
14:52
created

Psr17Provider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Web\Provider;
6
7
use Nyholm\Psr7\Factory\Psr17Factory;
8
use Yiisoft\Di\Container;
9
use Yiisoft\Di\Support\ServiceProvider;
10
use Psr\Http\Message\RequestFactoryInterface;
11
use Psr\Http\Message\ResponseFactoryInterface;
12
use Psr\Http\Message\ServerRequestFactoryInterface;
13
use Psr\Http\Message\StreamFactoryInterface;
14
use Psr\Http\Message\UploadedFileFactoryInterface;
15
use Psr\Http\Message\UriFactoryInterface;
16
17
final class Psr17Provider extends ServiceProvider
18
{
19
    /**
20
     * @suppress PhanAccessMethodProtected
21
     */
22
    public function register(Container $container): void
23
    {
24
        $container->set(RequestFactoryInterface::class, Psr17Factory::class);
25
        $container->set(ServerRequestFactoryInterface::class, Psr17Factory::class);
26
        $container->set(ResponseFactoryInterface::class, Psr17Factory::class);
27
        $container->set(StreamFactoryInterface::class, Psr17Factory::class);
28
        $container->set(UriFactoryInterface::class, Psr17Factory::class);
29
        $container->set(UploadedFileFactoryInterface::class, Psr17Factory::class);
30
    }
31
}
32