protected function loadContainer(Container $container, $data) { if (is_array($data) && isset($data['body'])) { $body = $data['body']; $elts = array(); if (isset($data['elements']) && is_array($data['elements'])) { foreach ($data['elements'] as $elementData) { $elt = $this->buildElement($elementData); if (!is_null($elt)) { $elts[$elt->getSerial()] = $elt; } } } $container->setElements($elts, $body); } else { common_Logger::w($data); throw new ParsingException('wrong array model'); } }
private function parseContainerChoice(DOMElement $data, Container $container, $tag) { $choices = array(); $gapNodes = $this->queryXPath(".//*[name(.)='" . $tag . "']", $data); foreach ($gapNodes as $gapNode) { $gap = $this->buildChoice($gapNode); if (!is_null($gap)) { $choices[$gap->getSerial()] = $gap; $this->replaceNode($gapNode, $gap); } } $bodyData = $this->getBodyData($data); $container->setElements($choices, $bodyData); $data = $this->parseContainerStatic($data, $container); return $data; }