Getter / Setter of the array of groups

get a group by key, set a group by key / value or set all of them with an array

@param  string|array $key
@param  Environemnt_Group $value
@return Environment|Environemnt_Group
492980
public function groups($key = NULL, $value = NULL)
	{
		if ($key === NULL)
			return $this->_groups;
	
		if (is_array($key))
		{
			$this->_groups = $key;
		}
		else
		{
			if ($value === NULL)
				return isset($this->_groups[$key]) ? $this->_groups[$key] : NULL;
	
			$this->_groups[$key] = $value;
		}
	
		return $this;
	}
506420
public function set(string $group, string $key, $value): ArrayCache
    {
        if ($group === "") {
            throw new \InvalidArgumentException(
                "invalid group provided; expecting a non empty string"
            );
        }

        if ($key === "") {
            throw new \InvalidArgumentException(
                "invalid key provided; expecting a non empty string"
            );
        }

        if ($value === null) {
            throw new \InvalidArgumentException(
                "invalid value provided; expecting anything but null"
            );
        }

        if (!isset($this->values[$group])) {
            $this->values[$group] = [];
        }

        $this->values[$group][$key] = $value;
        return $this;
    }
1219068
public function configSet($key, $value)
    {
        $keys = explode('.', $key);
        $this->loadConfigure($keys[0]);
        $config = &$this->config;

        while (count($keys) > 1) {
            $key = array_shift($keys);
            if (!isset($config[$key]) || ! is_array($config[$key])) {
                $config[$key] = [];
            }

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

        $config[array_shift($keys)] = $value;

        return $value;
    }
48314
public function set($key, $value = null)
    {
        $keys = is_array($key) ? $key : [$key => $value];

        foreach ($keys as $key => $value) {
            Arr::set($this->items, $key, $value);
        }
    }
339004
public function put($key, $value)
    {
        // if key exits then override
        if ($this::has($key)) {
            $setting = (new SettingModel)
                ->cached()
                ->where('key', $key)
                ->first();

            $setting->value = $value;

            return $setting->save();
        }

        return SettingModel::create([
            'key' => $key,
            'value' => $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;
        }
    }
1318259
public function update($key, $value, $group = self::DEFAULT_GROUP) {
        $this->repository->updateOrCreate($key, [
            'value' => $value,
            'group' => $group
        ]);

        return true;
    }
753049
public function set($key, $value = null){
        if(is_array($key)){
            $this->_dirty = $key;
        }
        else{
            $this->_dirty[$key] = $value;
        }
        
        return $this;
    }
280297
public function get($key, $group = self::DEFAULT_GROUP, $default = null) {
        $settings = $this->repository
            ->getByKey($key, $group);

        return isset($settings) ? $settings->value : $default;
    }
917803
private function setEnv($key, $value)
    {
        $array = $this->getEnv();
        $index = array_search($key, array_column($array, 'key'));
        if ($index !== false) {
            $array[$index]['value'] = $value; // 更新
        } else {
            array_push($array, ['key' => $key, 'value' => $value]); // 新增
        }
        return $this->saveEnv($array);
    }
740681
public function setValueByKey($key, $value)
    {
        $model = Configuration::whereConfigurationKey($key)->first();

        if (null === $model) {
            return null;
        }
        $model->update(['configuration_value' => $value]);

        return $model;
    }
824281
public function set($key, $value)
    {
        $keyExp = explode('.', $key);

        $row = $this->database
            ->table($this->config['db_table'])
            ->where('setting_key', $keyExp[0])
            ->first(['setting_value']);

        if (is_null($row))
        {
            $newKeyExp = array_slice($keyExp, 1);

            $newValue = $value;

            // if want to set a value directly from a dot keys
            if (count($newKeyExp) > 0)
            {
                // we should compose a new array with keys from setter key
                $newValue = build_array($newKeyExp, $value);
            }


            $this->database->table($this->config['db_table'])
                ->insert([
                    'setting_key'   => $keyExp[0],
                    'setting_value' => ( ! empty($newValue) ? json_encode($newValue) : null),
                ]);
        }
        else
        {
            $setting_value = json_decode($row->setting_value, true);
            set_nested_array_value($setting_value, $keyExp, $value);

            $this->database->table($this->config['db_table'])
                ->where('setting_key', $keyExp[0])
                ->update([
                    'setting_value' => json_encode($setting_value)
                ]);
        }


        $this->cache->set($key, $value);

        return $value;
    }
71646
public function set($key, $value)
    {
        $registry = ArrayHelper::set($this->getItems(), $key, $value, $useDotSyntax = true);
        $this->setItems($registry);

        return $this->getItems();
    }
111490
public function setting( $key, $value = false )
	{
		if( !$value )
		{
			return $this->_setting[$key];
		}
		else
		{
			$this->_setting[$key] = $value;
			return $value;
		}
	}
1029777
public function insert($key, $value, $group = self::DEFAULT_GROUP) {
        return $this->update($key, $value, $group);
    }
1175523
public Setting set(String group, String key, String value) {
		this.put(group, key, value);
		return this;
	}
727126
public function env($env, $value = null)
    {
        if (! is_array($env)) {
            $env = [$env => $value];
        }

        foreach ($env as $key => $value) {
            $this->env[$key] = $value;
        }

        return $this;
    }