|
@@ 13-22 (lines=10) @@
|
| 10 |
|
$file = $this->getFile(); |
| 11 |
|
$results = include $file; |
| 12 |
|
$config = new \SimpleXMLElement('<magiumConfiguration />'); |
| 13 |
|
foreach ($results as $section => $sectionData) { |
| 14 |
|
$sectionObj = $config->addChild('section'); |
| 15 |
|
$sectionObj['identifier'] = $section; |
| 16 |
|
if (isset($sectionData['label'])) { |
| 17 |
|
$sectionObj['label'] = $sectionData['label']; |
| 18 |
|
} |
| 19 |
|
if (isset($sectionData['groups'])) { |
| 20 |
|
$this->processGroups($sectionObj, $sectionData['groups']); |
| 21 |
|
} |
| 22 |
|
} |
| 23 |
|
|
| 24 |
|
$doc = new \DOMDocument(); |
| 25 |
|
$node = dom_import_simplexml($config); |
|
@@ 35-44 (lines=10) @@
|
| 32 |
|
|
| 33 |
|
protected function processGroups(\SimpleXMLElement $section, $groups) |
| 34 |
|
{ |
| 35 |
|
foreach ($groups as $groupId => $groupData) { |
| 36 |
|
$group = $section->addChild('group'); |
| 37 |
|
$group['identifier'] = $groupId; |
| 38 |
|
if (isset($groupData['label'])) { |
| 39 |
|
$group['label'] = $groupData['label']; |
| 40 |
|
} |
| 41 |
|
if (isset($groupData['elements'])) { |
| 42 |
|
$this->processElements($group, $groupData['elements']); |
| 43 |
|
} |
| 44 |
|
} |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
protected function processElements(\SimpleXMLElement $group, $elements) |