Repository navigation
Internals Vfs Resource ResourceBuilder
Framework Internals · Subsystem overview · Developer guide
Source: awt_src/classes/vfs/resource/ResourceBuilder.php · Snapshot 8411f4287706.
VFS includes package resource lookup, database-backed file metadata, filesystem collaborators, transient pools and persistent PHP-array caches.
class ResourceBuilderDeclarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.
| Member | Declaration | Purpose or source contract |
|---|---|---|
| Constructor-promoted | public function __construct(private string $path = PACKAGES) |
Initialized from the constructor argument; default expression is evaluated when the argument is omitted. |
| Method | Signature |
|---|---|
| __construct | public function __construct(private string $path = PACKAGES) |
| build | public function build(): array |
| directoryIterator | public static function directoryIterator(string $path, bool $recursive = false): array |
| scan | private static function scan(string $path, bool $recursive, array $ancestors): array |
public function __construct(private string $path = PACKAGES);| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
private string $path = PACKAGES |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.
public function build(): arrayReturn expressions (including local callbacks): self::directoryIterator($this->path, true).
Implementation, validation guards and interaction order
public function build(): array { return self::directoryIterator($this->path, true); }public static function directoryIterator(string $path, bool $recursive = false): array| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
$recursive |
bool $recursive = false |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): self::scan($path, $recursive, []).
Implementation, validation guards and interaction order
public static function directoryIterator(string $path, bool $recursive = false): array
{
return self::scan($path, $recursive, []);
}private static function scan(string $path, bool $recursive, array $ancestors): array| Parameter | Type, modifiers and default | Purpose |
|---|---|---|
$path |
string $path |
Filesystem or route path as defined by the owning component; no universal path normalization is implied. |
$recursive |
bool $recursive |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
$ancestors |
array $ancestors |
Operation input; the exact use, validation and propagation are shown in the implementation trace. |
Return expressions (including local callbacks): []; $names; $result.
Explicit exceptions: exceptions\ResourceException. The guards in the implementation below show when each is raised; exceptions from collaborators also propagate unless caught.
Implementation, validation guards and interaction order
private static function scan(string $path, bool $recursive, array $ancestors): array
{
if (!is_dir($path)) return [];
$real = realpath($path);
if ($real === false || isset($ancestors[$real])) return [];
$ancestors[$real] = true;
$names = @scandir($path);
if ($names === false) throw new exceptions\ResourceException("Cannot scan resource directory: {$path}");
$names = array_values(array_diff($names, ['.', '..']));
if (!$recursive) return $names;
$result = [];
foreach ($names as $name) {
$file = $path . DIRECTORY_SEPARATOR . $name;
if (is_dir($file)) {
// Descendant directory links are excluded from maps and cache watches.
if (!is_link($file)) $result[$name] = self::scan($file, true, $ancestors);
} elseif (is_file($file)) $result[$name] = $file;
}
return $result;
}AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes