public function readMultiText($sxeNode, $existingMultiText = null, $inputSystems = null) { if (isset($existingMultiText)) { $multiText = $existingMultiText; } else { $multiText = new LexMultiText(); } if (isset($sxeNode->form)) { foreach ($sxeNode->form as $form) { $inputSystemTag = (string) $form['lang']; $multiText->form($inputSystemTag, (string) $form->text); // TODO: Do we need to count input systems found in LIFT ranges? I think no, because // the input systems found in ranges are ones for which an interface translation has // been defined, which is not the same concept as "ones for which data exists". 2014-09 RM //$this->_projectModel->addInputSystem($inputSystemTag); if (isset($inputSystems)) { $inputSystems->ensureValueExists($inputSystemTag); } } } return $multiText; }
/** * Reads a MultiText from the XmlNode $sxeNode given by the element 'form' * * @param \SimpleXMLElement $sxeNode * @param ArrayOf $inputSystems * @param bool $ignoreErrors * @return LexMultiText */ public function readMultiText($sxeNode, $inputSystems = null, $ignoreErrors = false) { $multiText = new LexMultiText(); $this->addAndPushSubnodeError(LiftImportNodeError::MULTITEXT, $sxeNode->getName()); /** @var \SimpleXMLElement $element */ foreach ($sxeNode as $element) { switch ($element->getName()) { case 'form': $inputSystemTag = (string) $element['lang']; $value = self::sanitizeSpans(dom_import_simplexml($element->{'text'}[0]), $inputSystemTag, $this->currentNodeError()); $multiText->form($inputSystemTag, $value); $this->project->addInputSystem($inputSystemTag); if (isset($inputSystems)) { $inputSystems->ensureValueExists($inputSystemTag); } break; default: if (!$ignoreErrors) { $this->currentNodeError()->addUnhandledElement($element->getName()); } } } array_pop($this->nodeErrors); return $multiText; }