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