Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
13 | public function build($ruleName) |
||
14 | { |
||
15 | |||
16 | foreach ($this->getRulePrefixes() as $prefix) { |
||
|
|||
17 | |||
18 | $className = $prefix . ucfirst($ruleName); |
||
19 | if (!class_exists($className)) { |
||
20 | continue; |
||
21 | } |
||
22 | |||
23 | $reflection = new ReflectionClass($className); |
||
24 | return $reflection->newInstance(); |
||
25 | } |
||
26 | |||
27 | throw new \Exception(sprintf('"%s" is not a valid handler name', $ruleName)); |
||
28 | } |
||
29 | |||
36 |