RecordingEnvironmentReader
A decorating environment reader: wraps a real inner EnvironmentReaderInterface and appends one EffectKind::Env entry per get() call to an injected EffectLedger, returning the real value completely untouched to the caller.
Fingerprint is the bare variable name — unlike RecordingCache’s operation-scoped fingerprint, there is only one operation here (get(); environment variables are never written through this interface), so there is no cross-operation collision to guard against.
getenv()’s own contract already distinguishes “unset” (false) from any string value, including an empty one, so no extra hit/miss sentinel is needed the way RecordingCache::get() needed one for PSR-16’s null-vs-miss ambiguity: the recorded result is simply the exact string|false the inner reader returned.
A real-reader exception is never swallowed: no effect is recorded for a failed call, and the exception propagates exactly as it would through the undecorated reader, matching every other recorder in this package.
Synopsis
Section titled “Synopsis”final class RecordingEnvironmentReader implements EnvironmentReaderInterface
| Implements | EnvironmentReaderInterface |
| Source | Env/RecordingEnvironmentReader.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(EnvironmentReaderInterface $reader, EffectLedger $ledger, ClockInterface $clock = new SystemClock(…)): mixed
| Parameter | Type | Description |
|---|---|---|
$reader | EnvironmentReaderInterface | |
$ledger | EffectLedger | |
$clock | ClockInterface |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
| [`get(string $name): string | false`](#get) |
public function get(string $name): string|false
The value of environment variable $name, or false when it is unset.
| Parameter | Type | Description |
|---|---|---|
$name | string |
Returns string``|``false