trait InteractsWithEnvironment

Methods

void
setEnvironmentValue(string $key, string $value)

Set an environment variable for the current PHP process.

void
unsetEnvironmentValue(string $key)

Unset an environment variable for the current PHP process.

mixed
withEnvironmentValue(string $key, string|null $value, Closure $callback)

Run a callback with a temporary environment variable value.

mixed
withEnvironmentValues(array $values, Closure $callback)

Run a callback with temporary environment variable values.

Details

at line 15
protected void setEnvironmentValue(string $key, string $value)

Set an environment variable for the current PHP process.

Parameters

string $key
string $value

Return Value

void

at line 27
protected void unsetEnvironmentValue(string $key)

Unset an environment variable for the current PHP process.

Parameters

string $key

Return Value

void

at line 38
protected mixed withEnvironmentValue(string $key, string|null $value, Closure $callback)

Run a callback with a temporary environment variable value.

Parameters

string $key
string|null $value
Closure $callback

Return Value

mixed

at line 48
protected mixed withEnvironmentValues(array $values, Closure $callback)

Run a callback with temporary environment variable values.

Parameters

array $values
Closure $callback

Return Value

mixed