| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 |