ExtraMatchers   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 19
ccs 4
cts 4
cp 1
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 ExtraMatchers
8
{
9
    public static function register($matchers = [])
10
    {
11
        $map = [
12
            'toBeOneOf'    => 'Kahlan\Extra\Matcher\ToBeOneOf',
13
            'toEqualOneOf' => 'Kahlan\Extra\Matcher\ToEqualOneOf',
14
            'toImplement'  => 'Kahlan\Matcher\ToBeAnInstanceOf'
15 3
        ];
16 3
        $matchers = $matchers ?: array_keys($map);
17
18
        foreach ($matchers as $name) {
19
            if (!isset($map[$name])) {
20 1
                throw new Exception("Unexisting matcher `{$name}` can't register it.");
21
            }
22 2
            Matcher::register($name, $map[$name]);
23
        }
24
    }
25
}
26