Overwrite the last child of a structure for given value.

@param array $structure
@param mixed $value
420289
protected function overwriteLastValueFromStructure(
        array &$structure,
        $value
    ) {
        $pointer = &$structure;
        $currentKey = key($pointer);
        $currentValue = &$pointer[$currentKey];
        while (is_array($currentValue)) {
            $pointer = &$currentValue;
            $currentKey = key($pointer);
            $currentValue = &$pointer[$currentKey];
        }

        $pointer[$currentKey] = $value;
    }
733137
public function setElementValue($element, $value)
    {
        $node = $this->dom->createTextNode($value);
        $element->appendChild($node);
    }
1303951
public function setXmlValue(array $value)
    {
        $value = array_map(
            function ($value) {
                return 'true' === $value;
            },
            $value
        );
        parent::setXmlValue($value);
    }
535418
public function writeCData($value)
    {
        if (is_array($value)) {
            foreach ($value as $attrValue) {
                $this->context->writeCData($attrValue);
            }
        } else {
            $this->context->writeCData($value);
        }
    }
291222
public function push($value)
    {
        parent::push($value);
        $this->nodesEntities[] = $this->last()->entity->getEntityName();
    }
1237295
public function addStructureNodeRelatedByParentId(ChildStructureNode $structureNodeRelatedByParentId)
    {
        if ($this->collStructureNodesRelatedByParentId === null) {
            $this->initStructureNodesRelatedByParentId();
        }

        if (!$this->getStructureNodesRelatedByParentId()->contains($structureNodeRelatedByParentId)) {
            // only add it if the **same** object is not already associated
            $this->collStructureNodesRelatedByParentId->push($structureNodeRelatedByParentId);
            $this->doAddStructureNodeRelatedByParentId($structureNodeRelatedByParentId);
        }

        return $this;
    }
1224701
public function removeStructureNodeRelatedByParentId(ChildStructureNode $structureNodeRelatedByParentId)
    {
        if ($this->getStructureNodesRelatedByParentId()->contains($structureNodeRelatedByParentId)) { $structureNodeParent = new ChildStructureNodeParent();

            $structureNodeParent->setStructureNodeRelatedByParentId($structureNodeRelatedByParentId);
            if ($structureNodeRelatedByParentId->isStructureNodeRelatedByStructureNodeIdsLoaded()) {
                //remove the back reference if available
                $structureNodeRelatedByParentId->getStructureNodeRelatedByStructureNodeIds()->removeObject($this);
            }

            $structureNodeParent->setStructureNodeRelatedByStructureNodeId($this);
            $this->removeStructureNodeParentRelatedByStructureNodeId(clone $structureNodeParent);
            $structureNodeParent->clear();

            $this->collStructureNodesRelatedByParentId->remove($this->collStructureNodesRelatedByParentId->search($structureNodeRelatedByParentId));

            if (null === $this->structureNodesRelatedByParentIdScheduledForDeletion) {
                $this->structureNodesRelatedByParentIdScheduledForDeletion = clone $this->collStructureNodesRelatedByParentId;
                $this->structureNodesRelatedByParentIdScheduledForDeletion->clear();
            }

            $this->structureNodesRelatedByParentIdScheduledForDeletion->push($structureNodeRelatedByParentId);
        }


        return $this;
    }
166029
public function setHeader($header, $value)
    {
        if (is_array($value)) {
            throw new \Exception('Could not set the header: '.$header);
        }
        $this->headers[$header] = $value;
    }
1120112
public function setStructureNodeRelatedByParentId(ChildStructureNode $v = null)
    {
        if ($v === null) {
            $this->setParentId(NULL);
        } else {
            $this->setParentId($v->getId());
        }

        $this->aStructureNodeRelatedByParentId = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildStructureNode object, it will not be re-added.
        if ($v !== null) {
            $v->addStructureNodeParentRelatedByParentId($this);
        }


        return $this;
    }
479836
protected function addSequentialNode(DOMElement $element, $value): void
    {
        if (empty($element->nodeValue)) {
            $element->nodeValue = \htmlspecialchars($value);
            return;
        }

        $child = $this->element($element->nodeName);
        $child->nodeValue = \htmlspecialchars($value);
        $element->parentNode->appendChild($child);
    }
310410
public function hydrate( array $data, $structure )
    {
        if ( $structure instanceof Structure )
        {
            if ( isset( $data[self::PROPERTIES_FIELD] ) )
            {
                $properties = $data[self::PROPERTIES_FIELD] ?: array();
                unset( $data[self::PROPERTIES_FIELD] );

                if ( is_string( $properties ) )
                {
                    $properties = $this->parseProperties( $properties );
                }

                if ( is_array( $properties ) )
                {
                    $data[self::PROPERTIES_FIELD] = $properties;
                }
            }
            else
            {
                $data[self::PROPERTIES_FIELD] = array();
            }
        }

        return parent::hydrate( $data, $structure );
    }
257142
function(value) {
      // if trying to set wrong value (or ""), reset
      if (!lang.isArray(value)) {
         value = [];
      }
      
      var oldNb = this.ul.childNodes.length;
      var newNb = value.length;
      
      for(var i = 0 ; i < newNb ; i++) {
         if(i < oldNb) {
            this.updateItem(i, value[i]);
         }
         else {
            this.addItem(value[i]);
         }
      }
      
      // remove extra li items if any
      for(var j = newNb; j < oldNb; j++) {
         this._removeItem(newNb); // newNb is always the index of first li to remove (not j !)
      }
   }
710132
public function prune($structureNodeParent = null)
    {
        if ($structureNodeParent) {
            $this->addCond('pruneCond0', $this->getAliasedColName(StructureNodeParentTableMap::COL_STRUCTURE_NODE_ID), $structureNodeParent->getStructureNodeId(), Criteria::NOT_EQUAL);
            $this->addCond('pruneCond1', $this->getAliasedColName(StructureNodeParentTableMap::COL_PARENT_ID), $structureNodeParent->getParentId(), Criteria::NOT_EQUAL);
            $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
        }

        return $this;
    }
1176325
public function prepend($key, $value)
    {
        $array = $this->get($key);

        array_unshift($array, $value);

        $this->set($key, $array);
    }
913415
private function processValue($value)
    {
        $this->valueStack[] = $value;
        $value = $this->resolveValue($value);

        if (is_array($value) || is_object($value)) {
            $this->pushStack($value);
        } else {
            $this->outputJson($value, JsonToken::T_VALUE);
            array_pop($this->valueStack);
        }
    }
570350
public function setHumanValue($value)
    {
        $this->humanValue = $value;
        $old = $this->value;
        $this->value = static::humanToPlain($value);
        $this->onUpdate($old);
    }
146671
public function setRecursive($key, $value)
    {
        if (! is_array($value)) {
            $this->set($key, $value);
            return;
        }
        $subset = $this->getSubset($key);
        $array = $value;
        foreach ($array as $key => $value) {
            $subset->setRecursive($key, $value);
        }
    }