Conditions | 4 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 6 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
33 | 22 | public static function get($array) |
|
34 | { |
||
35 | 22 | if (!is_array($array)) { |
|
36 | 1 | throw new ConfigurationException('Unknown element declaration'); |
|
37 | } |
||
38 | |||
39 | 21 | $isAssoc = array_keys(array_keys($array)) !== array_keys($array); |
|
40 | |||
41 | 21 | if ($isAssoc || is_array(reset($array))) { |
|
42 | 4 | $array = ['collection', $array]; |
|
43 | 4 | } |
|
44 | |||
45 | 21 | return Factory::instantiate($array); |
|
46 | } |
||
47 | } |