Updates a single value with replacement for given key in yml file.

@param string       $key
@param string|array $value
@param bool         $backup

@return bool
4171
public function change($key, $value, $backup = true)
    {
        $yaml = $this->lines->join("\n");

        $pattern = '/^' . str_replace('/', ':.*?', $key) . '(:\s*)/mis';
        preg_match($pattern, $yaml, $matches, PREG_OFFSET_CAPTURE);
        if (!$matches) {
            // Throw exception by default in v4.0 instead of returning boolean.
            if (func_num_args() === 4 && func_get_arg(3)) {
                throw new \InvalidArgumentException(sprintf("The key '%s' was not found in %s.", $key, $this->file->getFullPath()));
            }

            return false;
        }

        $column = $matches[1][1] + strlen($matches[1][0]);
        $line = substr_count($yaml, "\n", 0, $column);

        $this->lines[$line] = preg_replace('/^(.*?):(.*(?= #)|.*$)/', '$1: ' . Inline::dump($value), $this->lines[$line]);

        $this->save($backup);

        return true;
    }
1079189
public function set($key, $value, $expiration = false)
    {
        $path = $this->filename($key);
        $umask = umask($this->umask);
        file_put_contents($path, $this->createValue($value, $expiration));
        umask($umask);
        return $this;
    }
144771
public function set(string $key, $value = null, int $expiration = 0) : bool
    {

        $this->updateMetaData($key, $expiration);
        $this->store[$key] = $value;

        $this->writeCount++;

        return true;
    }
357609
public function set( $key, $value ) {

		if ( isset( $this->redactedFields[$key] ) ) {
			return null;
		}

		$this->recordFields[$key] = $value;
	}
1233146
public function set( $key, $value ) {
		$this->reload_options();
		$suspend_reload         = $this->_suspend_reload;
		$prev                   = isset( $this->_options[ $key ] ) ? $this->_options[ $key ] : null;
		$this->_options[ $key ] = $value;
		if ( $prev !== $value ) {
			$this->_suspend_reload = true;
			$this->do_action( 'changed_option', $key, $value, $prev );
			$this->_suspend_reload = $suspend_reload;
		}

		return $this->save();
	}
568977
public static function set($path,$key,$value=null) {

		$data = CoreManager::all($path);

		if(CoreManager::has($data,$key)) {

			Artisan::call('config:cache');

			$current_key_value = $key.'='.env($key);

			$value = str_replace(' ' , '_', $value);

			$new_key_value = $key.'='.$value;

			$result = file_put_contents($path, str_replace($current_key_value,$new_key_value,file_get_contents($path)));

			Artisan::call('config:cache');

			return true;
		
		}

		return false;
	
	}
788559
public function updateAttr($key, $value)
    {
        if (isset($_SESSION[$key])) {
            $_SESSION[$key] = $value;
            return true;
        } else {
            return false;
        }
    }
707265
public function set($key, $value)
    {
        $config = &$this->config;

        foreach (explode('.', $key) as $k) {
            $config = &$config[$k];
        }

        $config = $value;

        return true;
    }
705461
protected function replaceArraySetting($file, $key, $value) {
    $this->taskReplaceInFile($file)
      ->regex("/'$key' => '[^'\\\\]*(?:\\\\.[^'\\\\]*)*',/s")
      ->to("'$key' => '". $value . "',")
      ->run();
  }
803827
public function updateSet($key, $value)
    {
        $update = ( ! $value instanceof SetUpdate)
            ? SetUpdate::createFromArray($value)
            : $value;

        $this->update->updateSet($key, $update->getOp());

        return $this;
    }
245226
public function appendMeta($key, $value)
    {
        $meta = $this->getMeta($key);

        if (!$meta) {
            $meta = [];

        } elseif (!is_array($meta)) {
            $meta = [$meta];
        }

        if (is_array($value)) {
            $meta = array_merge($meta, $value);
        } else {
            $meta[] = $value;
        }

        return $this->updateMeta($key, array_values(array_unique($meta)));
    }
1355718
public function set($key, $value)
    {
        $setting = SettingModel::create(
            [
                'key' => $key,
                'value' => $value,
            ]
        );

        return $setting ? $value : false;
    }
528440
public static function setBoolean($key, $value) {
		$_SESSION [$key] = UString::isBooleanTrue ( $value );
		return $_SESSION [$key];
	}
24681
public function set($key, $value)
    {
        if (is_bool($value)) {
            $value = $value ? 'true' : 'false';
        }

        return parent::set($key, $value);
    }
241539
public function addOrUpdateMeta($key, $value)
    {
        return $this->hasMeta($key) ? $this->updateMeta($key, $value) : $this->addMeta($key, $value);
    }
466597
public function updateMeta($key, $value)
    {
        if ($meta = $this->getMeta($key)) {
            $meta->value = $value;

            return $meta->save();
        }

        return false;
    }
27274
public function replaceValue($key, $value): bool {
        $replaced = false;
        $node = $this->getHead();
        while ($node !== null) {
            if (Comparator::equals($node->getKey(), $key)) {
                $node->setValue($value);
                $replaced = true;
            }
            $node = $node->getNext();
        }
        return $replaced;
    }