Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function build($method, $arguments = []) |
||
19 | { |
||
20 | $className = __NAMESPACE__ . '\\' . ucfirst($method) . 'Handler'; |
||
21 | |||
22 | if (class_exists($className)) { |
||
23 | |||
24 | $reflection = new ReflectionClass($className); |
||
25 | |||
26 | if (!$reflection->isInstantiable()) { |
||
27 | throw new Exception(sprintf('"%s" must be instantiable', $className)); |
||
28 | } |
||
29 | |||
30 | return $reflection->newInstanceArgs($arguments); |
||
31 | } |
||
32 | throw new Exception(sprintf('"%s" is not a valid rule name', $method)); |
||
33 | } |
||
35 | } |