| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 21 | private static function instantiate(array $declaration) |
|
| 21 | { |
||
| 22 | 21 | $fieldType = array_shift($declaration); |
|
| 23 | |||
| 24 | 21 | $class = "\\Zerg\\Field\\" . ucfirst(strtolower($fieldType)); |
|
| 25 | 21 | if (class_exists($class)) { |
|
| 26 | 20 | $reflection = new \ReflectionClass($class); |
|
| 27 | 20 | return $reflection->newInstanceArgs($declaration); |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | throw new ConfigurationException("Field {$fieldType} doesn't exist"); |
|
| 31 | } |
||
| 32 | |||
| 47 | } |