RouterCollectionProvider::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Package\Provide\Router;
6
7
use BEAR\Sunday\Extension\Router\RouterInterface;
8
use Ray\Di\Di\Inject;
9
use Ray\Di\Di\Named;
10
use Ray\Di\ProviderInterface;
11
12
class RouterCollectionProvider implements ProviderInterface
13
{
14
    /** @var RouterInterface */
15
    private $primaryRouter;
16
17
    /** @var WebRouterInterface */
18
    private $webRouter;
19
20
    /**
21
     * @Inject
22
     * @Named("router=primary_router")
23
     */
24
    public function __construct(RouterInterface $router, WebRouterInterface $webRouter)
25
    {
26
        $this->primaryRouter = $router;
27
        $this->webRouter = $webRouter;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function get(): RouterCollection
34
    {
35
        return new RouterCollection([$this->primaryRouter, $this->webRouter]);
36
    }
37
}
38