Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function createGramsFromXML(\SimpleXMLElement $xml): array |
||
19 | { |
||
20 | $grams = []; |
||
21 | |||
22 | foreach ($xml as $node) { |
||
23 | $gram = new Gram(); |
||
24 | $key = ''; |
||
25 | $value = ''; |
||
26 | |||
27 | /** |
||
28 | * TODO: Build loop |
||
29 | */ |
||
30 | |||
31 | $setter = 'set'.ucfirst($key); |
||
32 | if (is_callable([$grams, $setter])) { |
||
33 | $gram->$setter($key, $value); |
||
34 | } |
||
35 | |||
36 | array_push($grams, $gram); |
||
37 | } |
||
38 | |||
39 | return $grams; |
||
40 | } |
||
42 |