Skip to content

EnvironmentReaderInterface

The one seam a direct getenv() call site on the request path is meant to go through instead, mirroring ClockInterface’s and RandomnessInterface’s role for time() and random_bytes(): production gets SystemEnvironmentReader, a replay engine swaps in a stub answering from a recorded effect ledger.

The return type matches getenv()’s own contract exactly — false for an unset variable — rather than a nullable string, so a caller migrating from a bare getenv() call needs no change beyond the collaborator it reads through.

interface EnvironmentReaderInterface

Implemented byRecordingEnvironmentReader, StubbedEnvironmentReader, SystemEnvironmentReader
SourceSupport/Environment/EnvironmentReaderInterface.php
MethodDescription
[`get(string $name): stringfalse`](#get)

abstract public function get(string $name): string|false

The value of environment variable $name, or false when it is unset.

ParameterTypeDescription
$namestring

Returns string``|``false