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

RouterCollectionProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 50%
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 33
ccs 3
cts 6
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A __construct() 0 5 1
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