Completed
Push — master ( 6a3bf9...b976ac )
by Simon
02:24
created

ExtraMatcher   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 19
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 4
1
<?php
2
namespace Kahlan\Extra\Matcher;
3
4
use Exception;
5
use Kahlan\Matcher;
6
7
class ExtraMatcher
8
{
9
    public function register($matchers = [])
10
    {
11
        $map = [
12
            'toBeOneOf'    => 'Kahlan\Extra\Matcher\ToBeOneOf',
13
            'toEqualOneOf' => 'Kahlan\Extra\Matcher\ToEqualOneOf',
14
            'toImplement'  => 'Kahlan\Matcher\ToBeAnInstanceOf'
15
        ];
16
        $matchers = $matchers ?: array_keys($map);
17
18
        foreach ($matchers as $name) {
19
            if (!isset($map[$name])) {
20
                throw new Exception("Unexisting matcher `{$name}` can't register it.");
21
            }
22
            Matcher::register($name, $map[$name]);
23
        }
24
    }
25
}
26