Passed
Pull Request — master (#9)
by Pavel
11:27
created

CollectionMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A match() 0 8 2
1
<?php
2
3
namespace Bankiru\Api\Rpc\Routing;
4
5
use Bankiru\Api\Rpc\Routing\Exception\MethodNotFoundException;
6
7
final class CollectionMatcher implements MethodMatcher
8
{
9
    /**
10
     * @var MethodCollection
11
     */
12
    private $collection;
13
14
    /**
15
     * CollectionMatcher constructor.
16
     *
17
     * @param MethodCollection $collection
18
     */
19
    public function __construct(MethodCollection $collection)
20
    {
21
        $this->collection = $collection;
22
    }
23
24
    /** {@inheritdoc} */
25
    public function match($method)
26
    {
27
        if (!$this->collection->has($method)) {
28
            throw new MethodNotFoundException($method);
29
        }
30
31
        return AttributesHelper::getAttributes($this->collection->get($method), $method);
32
    }
33
}
34