Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2.0078 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | 63 | public static function createConstraint(string $name, string $value, string $match) |
|
33 | { |
||
34 | 63 | $parts = explode("-", $name); |
|
35 | $className = implode("", array_map(function (string $part) { |
||
36 | 63 | return ucfirst($part); //use locale-safe ucfirst function |
|
37 | 63 | }, $parts)); |
|
38 | 63 | $className = self::NAMESPACE_CONSTRAINTS . $className; |
|
39 | |||
40 | 63 | if (!class_exists($className)) { |
|
41 | throw new ClassNotFoundException($className); |
||
42 | } |
||
43 | 63 | return new $className($value, $match); |
|
44 | } |
||
46 |