/**
  * Reads a MultiText from the XmlNode $sxeNode given by the element 'gloss'
  *
  * @param \SimpleXMLElement $sxeNode
  * @param LexMultiText $multiText
  * @param ArrayOf $inputSystems
  * @throws \Exception
  */
 public function readMultiTextGloss($sxeNode, $multiText, $inputSystems = null)
 {
     CodeGuard::checkTypeAndThrow($multiText, 'Api\\Model\\Languageforge\\Lexicon\\LexMultiText');
     if ($sxeNode->getName() != 'gloss') {
         throw new \Exception("'" . $sxeNode->getName() . "' is not a gloss");
     }
     $inputSystemTag = (string) $sxeNode['lang'];
     $multiText->form($inputSystemTag, (string) $sxeNode->{'text'});
     $this->project->addInputSystem($inputSystemTag);
     if (isset($inputSystems)) {
         $inputSystems->ensureValueExists($inputSystemTag);
     }
 }
 /**
  * @param string $key
  * @param ArrayOf $model
  * @param array $data
  * @throws \Exception
  */
 public function decodeArrayOf($key, $model, $data)
 {
     if ($data == null) {
         $data = array();
     }
     CodeGuard::checkTypeAndThrow($data, 'array');
     $propertiesToKeep = array();
     // check if array item class has any private, read-only or recursive properties
     if (get_class($this) != 'Api\\Model\\Shared\\Mapper\\MongoDecoder' && $model->hasGenerator()) {
         $arrayItem = $model->generate();
         $propertiesToKeep = $this->getPrivateAndReadOnlyProperties($arrayItem);
         $propertiesToKeep = $this->getRecursiveProperties($arrayItem, $propertiesToKeep);
     }
     $oldModelArray = $model->exchangeArray(array());
     foreach ($data as $index => $item) {
         if ($model->hasGenerator()) {
             $object = $model->generate($item);
             // put back private, read-only and recursive properties into new object that was just generated
             foreach ($propertiesToKeep as $property) {
                 if (array_key_exists($index, $oldModelArray)) {
                     $object->{$property} = $oldModelArray[$index]->{$property};
                 }
             }
             $this->_decode($object, $item, '');
             $model[] = $object;
         } else {
             if (is_array($item)) {
                 throw new \Exception("Must not decode array for value type '{$key}'");
             }
             $model[] = $item;
         }
     }
 }
 /**
  * Ensures that the value $value is set
  * @param string $value
  */
 public function value($value)
 {
     if ($this->values->array_search($value) === FALSE) {
         $this->values[] = $value;
     }
 }