| Conditions | 3 |
| Paths | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 3 | public static function parse($input) |
|
| 22 | { |
||
| 23 | 3 | self::legacyClassLoading(); |
|
| 24 | try { |
||
| 25 | 3 | $array = \Symfony\Component\Yaml\Yaml::parse($input); |
|
| 26 | /** |
||
| 27 | * The parser can return integer or string |
||
| 28 | * if an number or a string is passed to it. |
||
| 29 | * We always need an configuration array, so |
||
| 30 | * we drop any other datatype here. |
||
| 31 | */ |
||
| 32 | 2 | if (!\is_array($array)) { |
|
| 33 | 2 | $array = []; |
|
| 34 | } |
||
| 35 | 1 | } catch (ParseException $e) { |
|
| 36 | /** |
||
| 37 | * @todo maybe log the error |
||
| 38 | */ |
||
| 39 | 1 | $array = []; |
|
| 40 | } |
||
| 41 | 3 | return $array; |
|
| 42 | } |
||
| 43 | |||
| 60 |