Completed
Pull Request — 1.x (#214)
by Yuu
03:24 queued 55s
created

RouterCollectionProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156
Metric Value
dl 0
loc 5
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1.0156
1
<?php
2
/**
3
 * This file is part of the BEAR.Package package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\Package\Provide\Router;
8
9
use BEAR\Sunday\Extension\Router\RouterInterface;
10
use Ray\Di\Di\Inject;
11
use Ray\Di\Di\Named;
12
use Ray\Di\ProviderInterface;
13
14
class RouterCollectionProvider implements ProviderInterface
15
{
16
    /**
17
     * @var RouterInterface
18
     */
19
    private $primaryRouter;
20
21
    /**
22
     * @var WebRouterInterface
23
     */
24
    private $webRouter;
25
26
    /**
27
     * @param RouterInterface    $router
28
     * @param WebRouterInterface $webRouter
29
     *
30
     * @Inject
31
     * @Named("router=primary_router")
32
     */
33 4
    public function __construct(RouterInterface $router, WebRouterInterface $webRouter)
34
    {
35 4
        $this->primaryRouter = $router;
36 4
        $this->webRouter = $webRouter;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function get()
43
    {
44
        return new RouterCollection([$this->primaryRouter, $this->webRouter]);
45
    }
46
}
47