Set an element of an array.

@param array  $storage
@param string $key   Specify a nested element by separating keys with full stops.
@param mixed  $value
420407
public static function set( array &$storage, $key, $value )
	{
		$segments = explode('.', $key);

		$key = array_pop($segments);

		// iterate through all of $segments except the last one
		foreach ($segments as $segment) {
			if (!array_key_exists($segment, $storage)) {
				$storage[$segment] = array();
			} else if (!is_array($storage[$segment])) {
				throw new \UnexpectedValueException('Non-array segment encountered');
			}

			$storage =& $storage[$segment];
		}

		$storage[$key] = $value;
	}
1106261
public function set($key, $value = null)
    {
        if (!$this->offsetExists($key)) {
            $this->storage[$key] = $value;
        }

        return $this;
    }
923406
public function offsetSet($key, $value)
    {
        $this->assertInstance($value);

        if ($key === null) {
            $this->storage[$value->name()] = $value;

            return;
        }

        $this->storage[$key] = $value;
    }
1085904
public function setStorageValue($value, $key = false) {
        $key = (!$key ? $this->name."InputResult" : $key);
        $this->getStorageContainer()->set($key, $value);
    }
906786
public function set($key, $value) {
		$this->loadIfNeeded();

		$this->array[$key] = $value;

		$this->saver->save($this->fileName, $this->array, $this->fileMap);
	}
1249783
public function push($value, $key = null)
    {
        if ($key == null) {
            $this->storage[] = $value;
        } else {
            $this->storage[$key] = $value;
        }

        return $this;
    }
494813
public static function set($key, $value, $scope = self::DEFAULT_SCOPE)
    {
        self::$storage[$scope][$key] = $value;
    }
156347
public static function set(&$array, $key, $value = null)
    {
        if (is_null($key)) {
            $array = $value;
            return;
        }
        if (is_array($key)) {
            foreach ($key as $k => $v) {
                static::set($array, $k, $v);
            }
        } else {
            $keys = explode('.', $key);
            while (count($keys) > 1) {
                $key = array_shift($keys);
                if (!isset($array[$key]) or !is_array($array[$key])) {
                    $array[$key] = [];
                }
                $array =& $array[$key];
            }
            $array[array_shift($keys)] = $value;
        }
    }
1000107
public function set(string $key, $value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }
        $this->normSet($key, $value);
    }
690131
public function set($key, $value, $save = true)
    {
        $this->load();
        NestedArrayUtil::setNestedArrayValue($this->state, explode('.', $key), $value);
        if ($save) {
            $this->save();
        }
    }
1074067
public static function set(array & $array, $key, $value)
    {
        if (strpos($key, '.') !== false) {
            $keys = explode('.', $key);
            $topKey = array_shift($keys);

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

            static::set($array[$topKey], implode('.', $keys), $value);
        } else {
            $array[$key] = $value;
        }
    }
771154
public function set($key, $value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }
        parent::set($this->normalizeKey($key), [
            'value' => $value,
            'originalKey' => $key
        ]);
    }
567672
public static function set(array &$array, $key, $value)
    {
        $keys = explode('.', $key);
        foreach($keys as $key) {
            if(!isset($array[$key])) {
                $array[$key] = [];
            }
            $array = &$array[$key];
        }

        $array = $value;
    }
760511
public static function forget( array &$storage, $key )
	{
		$segments = explode('.', $key);

		$key = array_pop($segments);

		// iterate through all of $segments except the last one
		foreach ($segments as $segment) {
			if (!array_key_exists($segment, $storage)) {
				return;
			} else if (!is_array($storage[$segment])) {
				throw new \UnexpectedValueException('Non-array segment encountered');
			}

			$storage =& $storage[$segment];
		}

		unset($storage[$key]);
	}
498345
public function setOption($key, $value=null)
    {
        if (is_array($key)) {
            foreach ($key as $k => $v) {
                $this->setOption($k, $v);
            }
        } else {
            $this->options[$key] = $value;
            
            if ($this->storage && in_array($key, StorageInterface::AllowOptions)) {
                $this->storage->setOption($key, $value);
            }
        }
        return $this;
    }
555999
public static function set($key, $value)
    {
        if (is_array($key)) {
            $now = self::self()->getContainer()['settings'];
            foreach ($key as $item) {
                $now = $now[$item];
            }
            $now = $value;
        } else {
            $settings = self::self()->getContainer()['settings'];
            $settings[$key] = $value;
        }
    }
641433
public function set($offset, $value = null)
    {
        if ($offset === null) {
            array_push($this->storage, $value);

            return $this;
        }

        if (is_array($offset)) {
            foreach ($offset as $key => $value) {
                $this->storage[$key] = $value;
            }

            return $this;
        }

        $this->setIntoArray($this->storage, explode(self::SEPARATOR, $offset), $value);

        return $this;
    }