Completed
Pull Request — master (#3)
by Pavel
09:01
created

Router   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 81.82%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 36
ccs 9
cts 11
cp 0.8182
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
A getCollection() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: batanov.pavel
5
 * Date: 16.02.2016
6
 * Time: 10:25
7
 */
8
9
namespace Bankiru\Api\Rpc\Routing;
10
11
class Router
12
{
13
    /** @var  MethodCollection */
14
    private $collection;
15
16
    /**
17
     * Router constructor.
18
     *
19
     * @param LoaderResolverInterface $resolver
20
     * @param array $resources
21
     * @param MethodCollection|null $collection
22
     */
23 8
    public function __construct(
24
        LoaderResolverInterface $resolver,
25
        array $resources = [],
26
        MethodCollection $collection = null)
27
    {
28 8
        $this->collection = $collection;
29
30 8
        if (null === $this->collection) {
31
            $this->collection = new MethodCollection();
32
        }
33
34 8
        foreach ($resources as $resource) {
35 8
            $this->collection->addCollection($resolver->resolve($resource)->load($resource));
36 8
        }
37 8
    }
38
39
    /**
40
     * @return MethodCollection
41
     */
42 8
    public function getCollection()
43
    {
44 8
        return $this->collection;
45
    }
46
}
47