Sensitive
in package
implements
JsonSerializable
Wraps a token-carrying value so it can never be accidentally exposed via `__toString()`, `var_export()`/`print_r()`, or JSON serialization (CONTRACT.md §7, D-11).
The wrapped value is stored in a private static WeakMap, keyed by the
Sensitive instance itself, rather than as a normal instance property. This means
the object carries zero introspectable properties: print_r()/var_export()/
var_dump() on a Sensitive show an empty object, since there is nothing on the
instance for PHP's reflection-based dumpers to enumerate. reveal() is the ONLY way
to obtain the underlying value; SDK-internal code that needs the raw token (e.g. to
build an Authorization header) calls it explicitly, at the point of use.
Table of Contents
Interfaces
- JsonSerializable
Methods
- __construct() : mixed
- __toString() : string
- Always returns the redacted literal, never the wrapped value.
- jsonSerialize() : string
- JSON hardening (D-11): json_encode() never emits the real value.
- reveal() : string
- The ONLY way to obtain the real value — call explicitly at the point of use.
Methods
__construct()
public
__construct(string $value) : mixed
Parameters
- $value : string
__toString()
Always returns the redacted literal, never the wrapped value.
public
__toString() : string
Return values
stringjsonSerialize()
JSON hardening (D-11): json_encode() never emits the real value.
public
jsonSerialize() : string
Return values
stringreveal()
The ONLY way to obtain the real value — call explicitly at the point of use.
public
reveal() : string