Documentation

RootIndex
in package

Lazy recursive filename index of one root directory. This is the slow path behind Registry::find(): it is only built after every direct probe missed, and is memoized per (root, extensions) for the request.

Fulfils the abstraction asked for by z_migrationModel::getFiles()'s "@TODO: abstract RecursiveIteratorIterator".

Table of Contents

$all  : array<string|int, mixed>
$byName  : array<string|int, mixed>
$extensions  : array<string|int, mixed>
$root  : string
all()  : array<string|int, string>
find()  : string|null
Locates a bare name inside this root: shallowest match first, ties broken by byte-order comparison of the relative path, so resolution is identical across filesystems.
for()  : self
__construct()  : mixed
build()  : void

Properties

$all

private array<string|int, mixed> $all = []

all indexed files, absolute, sorted

$byName

private array<string|int, mixed> $byName = []

filename (no extension) => sorted relative paths

$extensions

private array<string|int, mixed> $extensions

Methods

all()

public all() : array<string|int, string>
Return values
array<string|int, string>

Absolute paths of every indexed file, sorted.

find()

Locates a bare name inside this root: shallowest match first, ties broken by byte-order comparison of the relative path, so resolution is identical across filesystems.

public find(string $name) : string|null
Parameters
$name : string
Return values
string|null

for()

public static for(string $root, array<string|int, mixed> $extensions) : self
Parameters
$root : string
$extensions : array<string|int, mixed>
Return values
self

__construct()

private __construct(string $root, array<string|int, mixed> $extensions) : mixed
Parameters
$root : string
$extensions : array<string|int, mixed>
Return values
mixed

build()

private build() : void
Return values
void

Search results