Sets the value of a key for the given array if that property
has not already been set.

@param &assoc $arr the object to update.
@param string $key the key to update.
@param mixed $value the value to set.
187376
public static function setdefault(&$arr, $key, $value) {
    isset($arr[$key]) or $arr[$key] = $value;
  }
1130090
public function setGet($key, $value = null)
    {
        if (is_array($key)) {
            $this->get = array_merge($this->get, $key);
        } else {
            $this->get[$key] = $value;
        }
    }
1028113
public function fromArray(array $arr)
    {
        foreach ($arr as $key => $value) {
            $method = 'set' . $key;
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }
    }
923466
public function setOption($key, $value=null)
	{
	    if (is_array($key)) {
	        foreach ($key as $k => $v) {
	            $this->setOption($k, $v);
	        }
	    } else {
	        $this->options[$key] = $value;
	    }
	}
1000107
public function set(string $key, $value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }
        $this->normSet($key, $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 );
		}
	}
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;
        }
    }
918027
protected function setKey($key, $value)
    {
        if ($key == $this->_keyName) {
            $this->_keyValue = $value;
            $this->_key['value'] = $value;
        }
    }
559689
public function setJsonValue(array $value)
    {
        // Removing colons from value.
        $value = str_replace(
            ':',
            '',
            $value
        );

        if (1 === count($value)) {
            $this->setValue(reset($value));
        } else {
            $this->setValue($value);
        }
    }
902326
public function setValue($key, array $value, string $table)
    {
        $this->checkTable($table);

        $this->$table->set($key, ['value' => json_encode($value)]);

        return $this;
    }
152808
public function set($key, $value)
    {
        $data = &$this->data;
        if ($this->isDotNotation($key)) {
            $keys = explode('.', $key);
            $key = array_pop($keys);

            foreach ($keys as $segment) {
                if (!isset($data[$segment]) || !is_array($data[$segment])) {
                    $data[$segment] = [];
                }

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

        $data[$key] = $value;
    }
780336
public function set($key, $value) {
        if (is_array($key)) {
            $this->data = array_merge($this->data, $key);
        } else {
            $this->data[ $key ] = $value;
        }
        return $this;
    }
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;
    }
27560
public static function set($keys, $value = null)
    {
        if (is_array($keys)) {
            self::$variables = array_merge(self::$variables, $keys);
        } else {
            self::$variables[$keys] = $value;
        }
    }
705647
public function offsetSet($key, $value)
	{
		if (is_array($key) || is_object($key))
		{
			foreach ($key as $k => $v)
			{
				$this->attributes[$k] = $v;
			}
		}
		else
		{
			$this->attributes[$key] = $value;
		}
	}
531333
final public function setData($key, $value)
    {
        if (empty($key)) {
            return false;
        }
        $this->data = \WebServCo\Framework\ArrayStorage::set($this->data, $key, $value);
        return true;
    }
1272701
public static function set(&$array, $key, $value)
    {
        $key = static::normalizeKey($key);

        if ($key === null || $key === '')
        {
            return ($array = $value);
        }

        $keys = explode('.', $key);
        $last = array_pop($keys);
        $currentElement =& $array;

        foreach ($keys as $currentKey)
        {
            if (!array_key_exists($currentKey, $currentElement) || !is_array($currentElement[$currentKey]))
            {
                $currentElement[$currentKey] = [];
            }

            $currentElement =& $currentElement[$currentKey];
        }

        $currentElement[$last] = $value;

        return $array;
    }