Add an element at the end of an array recursively (last child).

@param array      $structure
@param string|int $key
@param mixed      $value
170400
private static function appendValueIntoStructure(
        array &$structure,
        $key,
        $value
    ) {
        $pointer = &$structure;
        while (!empty($pointer)) {
            $currentKey = key($pointer);
            $pointer = &$pointer[$currentKey];
        }
        $pointer[$key] = $value;
    }
690303
public static function buildStructure($array, Structure $structure)
    {
        switch ($structure->getType()) {
            case Structure::TYPE_LIST:
                $result = self::buildList($array, $structure);
                break;
            case Structure::TYPE_ARRAY:
                $result = self::buildArray($array, $structure);
                break;
            default:
                throw new Exception('Unknown structure type ' . $structure->getType());
        }

        return $result;
    }
525308
public function offsetSet($key, $value) {
        if(!$this->offsetExists($key)) {
            $this->table[$key] = new Value($value);
        } else {
            $this->table[$key]->setValue($value);
        }
    }
940295
public function put( $key, $value = null ) {
		if ( ! is_array( $key ) ) {
			$key = [ $key => $value ];
		}

		foreach ( $key as $array_key => $array_value ) {
			Arr::set( $this->attributes, $array_key, $array_value );
		}
	}
934175
public static function add($key, $value)
    {
        if (!isset(self::$config[$key]) || !is_array(self::$config[$key])) {
            return false;
        }
        array_push(self::$config[$key], $value);
        return true;
    }
1183076
public void put(K[] key, V value) {
        Node child = root.get(key[0]);
        if (child == null) {
            child = new Node(key[0]);
            root.put(key[0], child);
        }
        child.addChild(key, value, 1);
    }
1034865
public static function push(array &$array, $key, $value)
    {
        $keys = explode('.', $key);
        foreach($keys as $key) {
            if(!isset($array[$key])) {
                $array[$key] = [];
            }
            $array = &$array[$key];
        }

        if(!is_array($array)) {
            $array = [];
        }

        array_push($array, $value);
    }
1290980
private function createStructureNodes(\DOMDocument $dom, ElementStructure $structure)
    {
        $structureNode = $dom->createElement('structure');

        $idAttr = $dom->createAttribute('id');
        $idAttr->value = $structure->getId();
        $structureNode->appendChild($idAttr);

        $dsIdAttr = $dom->createAttribute('dsId');
        $dsIdAttr->value = $structure->getDsId();
        $structureNode->appendChild($dsIdAttr);

        $parentDsIdAttr = $dom->createAttribute('parentDsId');
        $parentDsIdAttr->value = $structure->getDsId();
        $structureNode->appendChild($parentDsIdAttr);

        $nameAttr = $dom->createAttribute('name');
        $nameAttr->value = $structure->getName();
        $structureNode->appendChild($nameAttr);

        $parentNameAttr = $dom->createAttribute('parentName');
        $parentNameAttr->value = $structure->getParentName();
        $structureNode->appendChild($parentNameAttr);

        foreach ($structure->getStructures() as $childStructure) {
            $structureNode->appendChild(
                $this->createStructureNodes($dom, $childStructure)
            );
        }

        foreach ($structure->getValues() as $value) {
            $valueNode = $dom->createElement('value');

            $idAttr = $dom->createAttribute('id');
            $idAttr->value = $value->getId();
            $valueNode->appendChild($idAttr);

            $dsIdAttr = $dom->createAttribute('dsId');
            $dsIdAttr->value = $value->getDsId();
            $valueNode->appendChild($dsIdAttr);

            $languageAttr = $dom->createAttribute('language');
            $languageAttr->value = $value->getLanguage();
            $valueNode->appendChild($languageAttr);

            $nameAttr = $dom->createAttribute('name');
            $nameAttr->value = $value->getName();
            $valueNode->appendChild($nameAttr);

            $typeAttr = $dom->createAttribute('type');
            $typeAttr->value = $value->getType();
            $valueNode->appendChild($typeAttr);

            $dataTypeAttr = $dom->createAttribute('dataType');
            $dataTypeAttr->value = $value->getDataType();
            $valueNode->appendChild($dataTypeAttr);

            $rawValue = $value->getValue();
            if ($value->getDataType() === 'array') {
                $rawValue = json_encode($rawValue);
            }
            $valueNode->appendChild($dom->createCDATASection($rawValue));

            $structureNode->appendChild($valueNode);
        }

        return $structureNode;
    }
1320297
public function put($key, $value = null)
    {
        if (! is_array($key)) {
            $key = [$key => $value];
        }

        foreach ($key as $arrayKey => $arrayValue) {
            Arr::set($this->attributes, $arrayKey, $arrayValue);
        }
    }
891319
protected function parseHeader($structure, $document)
    {
        $elements = array();
        $count    = count($structure);

        for ($position = 0; $position < $count; $position += 2) {
            $name  = $structure[$position][1];
            $type  = $structure[$position + 1][0];
            $value = $structure[$position + 1][1];

            $elements[$name] = $this->parseHeaderElement($type, $value, $document);
        }

        return new Header($elements, $document);
    }
701849
public function add ($key , $value) {
        if (!$this->beforeAdd()) {
            return false;
        }
        if (!$this->getConnection ()->getClient ()->zadd ($this->name , $value , $key)) {
            return false;
        }
        $this->_data = null;
        $this->_count = null;
        $this->afterAdd();
        return true;
    }
346379
public function accumulate($element, $key)
    {
        $accumulate = $this->accumulator;
        $accumulate($this->structure, $element, $key);
    }
1192178
public function push($key, $value)
    {
        $array      = $this->getValue($key);
        $array[]    = $value;
        $this->setValue($key, $array);
    }
1138103
public function set($key, $value = null) : void
    {
        if (is_array($key)) {
            $this->storage  = array_replace_recursive($this->storage, $key);
        } elseif ($value !== null) {
            $key = $this->getCompositeKey($key);
            ArrayHelper::set($this->storage, $key, $value);
        }
        $this->cache->set(self::KEY, $this->storage);
    }
198815
protected final function appendValueTo(
       SimpleXMLElement $parent,
       $key,
       $value): SimpleXMLElement
   {
       $parent->addChild($key);
       if (is_object($value) || is_array($value)) {
           foreach ($value as $subKey => $subValue) {
               $this->appendValueTo($parent->{$key}, $subKey, $subValue);
           }
           if (!isset($subKey)) {
               $parent->{$key}[0] = "";
           }
       } else if (is_scalar($value) || !$value) {
           $parent->{$key}[0] = (string) $value;
       }
       return $parent->{$key};
   }
989621
public function addHeader($key, $value) {
		if (is_array($value)) {
			foreach ($value as $v) {
				$this->addHeader($key, $v);
			}
		} else {
			$this->headers[$key][] = $value;
		}
		return $this;
	}
206146
public function add($key, $value): self
    {
        if (is_array($key)) {
            @ [$key, $value] = $key;
        }

        return $this->set($key, $value);
    }