insertValueIntoStructureByPath

@param array<string> $path
@param array $target
@param mixed $value
@return void
13121
static protected function insertValueIntoStructureByPath(array $path, &$target, $value) {
		$segment = array_shift($path);
		if (count($path) > 0) {
			if (!array_key_exists($segment, $target)) {
				$target[$segment] = array();
			}
			self::insertValueIntoStructureByPath($path, $target[$segment], $value);
		} else {
			$target[$segment] = $value;
		}
		ksort($target);
	}
1201055
public function set($path, $value)
    {
        $p = explode('.', $path);
        $cfg = &$this->config;
        $count = 1;

        foreach ($p as $part) {
            if ($count == count($p)) {
                $cfg[$part] = $value;
                continue;
            }
            if (array_key_exists($part, $cfg)) {
                $cfg = &$cfg[$part];
            } else {
                // create the path
                $cfg[$part] = array();
                $cfg = &$cfg[$part];
            }
            $count++;
        }
    }
1264403
public function set($path, $value)
    {
        $configValue = $this->getRepository()->findOneByPath($path);
        if ($configValue) {
            $configValue->setValue($value);
            $this->update($configValue);
        }
    }
555416
protected function assignArrayByDotPath(&$arr, string $path, string $value)
    {
        $keys = explode('.', $path);

        // Check that no key have a '0' value
        // This is because the '0' key is not read
        foreach ($keys as $keyValue) {
            if ($keyValue == '0') {
                throw new InvalidArgumentException('Invalid key in input array: part of the key in dot notation can NOT be \'0\'.');
            }
        }

        // Check if the allowed maximum level of nested array is exceeded
        $nestingLevels = count($keys);

        if ($nestingLevels > $this->allowedNestedArrays) {
            throw new TooManyNestedArraysException("Too many nested arrays in the input arrays. Maximum allowed is: " . $this->allowedNestedArrays);
        }

        while ($key = array_shift($keys)) {
            $arr = &$arr[$key];
        }

        $arr = $value;
    }
548132
public function addEdge( $source, $target, $value = 1 )
	{
		if( $source->getNodeName() < $target->getNodeName() )
			return $this->edgeSet->addEdge( $source, $target, $value );
		else
			return $this->edgeSet->addEdge( $target, $source, $value );
	}
165494
public static function setByPath(&$data, $path, $value, $separator = '.')
    {
        if (false === strpos($path, $separator)) {
            $data[$path] = $value;

            return true;
        }

        if (!$nodes = Str::toArray($path, $separator)) {
            return false;
        }

        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (\is_array($dataTmp)) {
                if (empty($dataTmp[$node])) {
                    $dataTmp[$node] = [];
                }

                $dataTmp = &$dataTmp[$node];
            } else {
                // If a node is value but path is not go to the end, we replace this value as a new store.
                // Then next node can insert new value to this store.
                $dataTmp = array();
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        $dataTmp = $value;

        return true;
    }
738061
public function set($path, $value)
    {
        if (!empty($path)) {
            $at   = &$this->getValues();
            $keys = $this->explode($path);

            while (count($keys) > 0) {
                if (count($keys) === 1) {
                    if (is_array($at)) {
                        $at[array_shift($keys)] = $value;
                    } else {
                        throw new \RuntimeException("Can not set value at this path ($path) because is not array.");
                    }
                } else {
                    $key = array_shift($keys);
                    if (!isset($at[$key])) {
                        $at[$key] = [];
                    }
                    $at = &$at[$key];
                }
            }
        } else {
            $this->values = $value;
        }
    }
845921
public function set($path, $value)
    {
        $parts = explode('.', $path);
        switch (count($parts)) {
            case 2:
                $this->_data[$parts[0]][$parts[1]] = $value;
                break;
            case 1:
                $this->_data[$parts[0]] = $value;
                break;
            case 0:
                throw new RuntimeException('Path was empty.');
            default:
                throw new RuntimeException('Too many parts in path.');
        }
    }
1025367
public function set( $path, $value = null )
    {
        if ( is_null( $value ) ) {
            return $this->delete( $path );
        }

        $path = str_replace( '/', '.', $path );
        $keys = explode( ".", $path );

        $copy = $this->_value;

        $array = &$copy;

        foreach ( $keys as $key ) {
            if ( ! isset( $array[ $key ] ) ) {
                $array[ $key ] = '';
            }

            $array = &$array[ $key ];
        }

        $array = $value;

        $this->update( $copy );

        return $value;
    }
653277
public function addEdge( $source, $target, $value = 1 )
	{
		return $this->edgeSet->addEdge( $source, $target, $value );
	}
1343198
private function saveToCache($path, $value)
    {
        if ($this->getCache()) {
            $this->getCache()->save(self::CACHE_KEY . md5($path), $value, null, [
                '_wf',
                '_component',
                '_router'
            ]);
        }
    }
516029
public function rm(array &$array, string $path): void
    {
        // This way it will trigger an error if the calculated value is not correct
        $node = null;
        $path = new PropertyPathBuilder($path);

        $nodes        = $path->getPropertyPath()->getElements();
        $parentLevel  = null;
        $currentLevel = &$array;
        foreach ($nodes as &$node) {
            $parentLevel  = &$currentLevel;
            $currentLevel = &$currentLevel[$node];
        }

        if (null !== $parentLevel) {
            unset($parentLevel[$node]);
        }
    }
61465
public function insert($value, $priority)
    {
        if (is_int($priority)) {
            $priority = [$priority, $this->counter--];
        }
        parent::insert($value, $priority);
    }
1304671
public static function setValue(&$array, $key, $value)
    {
        if (is_string($key)) {
            // Iterate path
            $keys = explode('.', $key);
            foreach ($keys as $key) {
                if (!isset($array[$key]) || !is_array($array[$key])) {
                    $array[$key] = [];
                }
                $array = &$array[$key];
            }
            // Set value to path
            $array = $value;
        } elseif (is_array($key)) {
            // Iterate array of paths and values
            foreach ($key as $k => $v) {
                self::setValue($array, $k, $v);
            }
        }
    }
975669
public function pushIn($key, $path, $value)
    {
        return $this->setIn($key, $path, $value, true);
    }
5352
public function set($path, $value)
    {
        Arr::set($this->data, $path, $value);

        return true;
    }
1040309
public function addData($path, $value)
    {
        $path = explode('.', $path);

        if (empty($path[0])) {
            return;
        }

        $jsdata = $this->app['jsdata'];
        $part = &$jsdata;

        foreach ($path as $key) {
            if (!isset($part[$key])) {
                $part[$key] = [];
            }

            $part = &$part[$key];
        }

        $part = $value;
        $this->app['jsdata'] = $jsdata;
    }