Set an environment variable (at runtime).

This is done using:
- putenv,
- $_ENV,
- $_SERVER.

The environment variable value is stripped of single and double quotes.

@param string      $name
@param string|null $value

@return void
765243
private function setEnvValue($name, $value)
    {
        // If PHP is running as an Apache module and an existing
        // Apache environment variable exists, overwrite it
        if (function_exists('apache_getenv') && function_exists('apache_setenv') && apache_getenv($name)) {
            apache_setenv($name, $value);
        }

        if (function_exists('putenv')) {
            putenv("$name=$value");
        }

        $_ENV[$name] = $value;
        $_SERVER[$name] = $value;
    }
448445
public function setAttribute($name, $value = null)
    {
        if (is_array($name)) {
            foreach ($name as $k => $v) {
                $this->attributes[$k] = $v;
            }
        } else {
            $this->attributes[$name] = $value;
        }
    }
949186
public function withEnv(string $name, string $value): self
    {
        $builder = clone $this;
        $builder->env[$name] = $value;
        
        return $builder;
    }
457383
protected function setRaw($name, $value, Environment $env, $valueUnreduced = null)
    {
        $env->store[$name] = $value;

        if ($valueUnreduced) {
            $env->storeUnreduced[$name] = $valueUnreduced;
        }
    }
481520
public function set($name)
    {
        if (!array_key_exists($name, $this->environments)) {
            throw new UndefinedEnvironmentException($name);
        }

        $this->current = $name;
        $this->environments[$name]->run();
    }
590008
protected function setParam($name, $value) {
        $params = $this->getParams();
        $params->$name = $value;
        $this->setParams($params);
    }
107807
public function set(string $name, $value = null) : void
    {
        Arr::set($this->registry, $name, $value);
    }
552238
public function set($name, $value) {
		$this->vars[$name] = is_object($value) ? (method_exists($value, 'fetch') ? $value->fetch() : $value) : $value;
	}
717555
public function setOption(string $name, string $value): void
    {
        $this->options[$name] = $value;
    }
490693
public function setCookie($name, $value = null) {
    if ($value === null) {
      $this->browser->removeCookie($name);
    }
    //TODO: set the cookie with domain, not with url, meaning www.aaa.com or .aaa.com
    if ($value !== null) {
      $urlData = parse_url($this->getCurrentUrl());
      $cookie = array("name" => $name, "value" => $value, "domain" => $urlData["host"]);
      $this->browser->setCookie($cookie);
    }
  }
926774
public static function pageSet(string $name, $value, ?string $page = null): void
    {
        if ($page === null) {
            $page = $_SERVER['PHP_SELF'];
        }
        self::set($name, $value, $page);
    }
501884
public function set(string $var, string $value = null):DotEnv{
		$var   = strtoupper($var);
		$value = $this->parse($value);

		if($this->global === true){
			putenv($var.'='.$value);

			// fill $_ENV explicitly, assuming variables_order="GPCS" (production)
			$_ENV[$var] = $value;

			// @codeCoverageIgnoreStart
			if(function_exists('apache_setenv')){
				/** @noinspection PhpComposerExtensionStubsInspection */
				apache_setenv($var, $value);
			}
			// @codeCoverageIgnoreEnd
		}

		// a backup
		$this->_ENV[$var] = $value;

		return $this;
	}
461984
private function setEnvironmentVariables(array $env)
    {
        foreach ($env as $name => $value) {
            putenv("$name=$value");

            $_ENV[$name] = $value;
            $_SERVER[$name] = $value;
        }
    }
804596
public static function set($key, $value)
    {
        putenv(vsprintf('%s=%s', [$key, $value]));
        $_ENV[$key] = $value;
        $_SERVER[$key] = $value;
    }
342494
public function setAttribute(string $name, $value): void
	{
		Arr::set($this->attributes, $name, $value);
	}
673212
public function set(string $name, $value = null): self
    {
        $this->variables[$name] = $value;
        return $this;
    }
2266
public function setValue($name, $value) {
        $this->_states[count($this->_states) - 1][1][$name] = $value;
    }