MemoryLoader
in package
implements
FileLoader
FinalYes
In-memory loader over a fixed { key: doc } map. Port of the JS MemoryLoader.
Shared fixtures pass a file set here; the engine resolves $ref against it with no disk access. Keys are the normalized identifiers (normalize() output).
PHP arrays are value types (copy-on-write), so a returned document can never mutate the source file set — no defensive clone needed (the JS port uses structuredClone for that exact guarantee).
Table of Contents
Interfaces
- FileLoader
- File loader for $ref resolution. Port of validator-ts/src/compose/loader.ts.
Properties
- $files : array<string, array<string, mixed>>
Methods
- __construct() : mixed
- load() : array<string, mixed>
- Return the parsed document at the normalized key, or throw REF_FILE_NOT_FOUND when absent (an unresolved $ref is a load error).
- normalize() : string
- Absolute (/-leading) path passes through; relative gets the basepath prefix.
Properties
$files
private
array<string, array<string, mixed>>
$files
Methods
__construct()
public
__construct(array<string, array<string, mixed>> $files) : mixed
Parameters
- $files : array<string, array<string, mixed>>
load()
Return the parsed document at the normalized key, or throw REF_FILE_NOT_FOUND when absent (an unresolved $ref is a load error).
public
load(string $key) : array<string, mixed>
Parameters
- $key : string
Return values
array<string, mixed>normalize()
Absolute (/-leading) path passes through; relative gets the basepath prefix.
public
normalize(string $path, string $basepath) : string
Parameters
- $path : string
- $basepath : string