70 private function parseXml(SimpleXMLElement $locale)
73 foreach ($locale as $node) {
74 switch ($node->getName()) {
76 $this->optionsXml->add(
'options', $node);
77 foreach ($node->attributes() as $name => $value) {
78 if ((
string) $value ==
'true') {
79 $this->options->add($name, [
true]);
81 $this->options->add($name, [
false]);
86 $this->termsXml->add(
'terms', $node);
87 $plural = [
'single',
'multiple'];
90 foreach ($node->children() as $child) {
93 foreach ($child->attributes() as $key => $value) {
94 $term->{$key} = (string) $value;
97 $subChildren = $child->children();
98 $count = $subChildren->count();
101 foreach ($subChildren as $subChild) {
102 $name = $subChild->getName();
103 $value = (string) $subChild;
104 if (in_array($subChild->getName(), $plural)) {
105 $term->{$name} = $value;
109 $value = (string) $child;
110 $term->{
'single'} = $value;
111 $term->{
'multiple'} = $value;
113 if (!$this->terms->hasKey($term->getName())) {
114 $this->terms->add($term->getName(), []);
117 $this->terms->add($term->getName(), $term);
121 $form = (string) $node[
"form"];
122 $this->dateXml->add($form, $node);
123 foreach ($node->children() as $child) {
124 $date =
new stdClass();
126 foreach ($child->attributes() as $key => $value) {
127 if (
"name" === $key) {
128 $name = (string) $value;
130 $date->{$key} = (string) $value;
132 if ($child->getName() !==
"name-part" && !$this->terms->hasKey($name)) {
133 $this->terms->add($name, []);
135 $this->date->add($form, $date);
148 $arr = $this->optionsXml->toArray();
149 return array_pop($arr);
157 return $this->dateXml->toArray();
165 $arr = $this->dateXml->toArray();
166 return array_pop($arr[
'date']);
174 $arr = $this->termsXml->toArray();
175 return array_pop($arr);