Skip to content

Internals Vfs Transient Enums ETransientType

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

vfs\transient\enums\ETransientType

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/vfs/transient/enums/ETransientType.php · Snapshot 8411f4287706.

VFS includes package resource lookup, database-backed file metadata, filesystem collaborators, transient pools and persistent PHP-array caches.

ETransientType

Declaration and architectural role

enum ETransientType: string

Constants, enum cases, traits and properties

Declarations 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
case PHP case PHP = 'php'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case JSON case JSON = 'json'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case XML case XML = 'xml'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case TXT case TXT = 'txt'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case HTML case HTML = 'html'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case JS case JS = 'js'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case CACHE case CACHE = 'cache'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case IMAGE case IMAGE = 'image'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case VIDEO case VIDEO = 'video'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case DOCUMENT case DOCUMENT = 'document'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case ARCHIVE case ARCHIVE = 'archive'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.
case FILE case FILE = 'file'; State or definition consumed by the methods below; reads and writes are preserved in their implementation traces.

Method index

Method Signature
fromPath public static function fromPath(string $path): self
fromExtension public static function fromExtension(string $extension): self
getDefaultExtension public function getDefaultExtension(): string
matchesExtension public function matchesExtension(string $extension): bool
isBinary public function isBinary(): bool
isText public function isText(): bool

fromPath

Source line 26

public static function fromPath(string $path): self

Parameters

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.

Resolve enum from file path

Return expressions (including local callbacks): self::fromExtension($ext).

Implementation, validation guards and interaction order
/**
     * Resolve enum from file path
     */
    public static function fromPath(string $path): self
    {
        $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
        return self::fromExtension($ext);
    }

fromExtension

Source line 35

public static function fromExtension(string $extension): self

Parameters

Parameter Type, modifiers and default Purpose
$extension string $extension Operation input; the exact use, validation and propagation are shown in the implementation trace.

Resolve enum from extension

Return expressions (including local callbacks): match (true) { /* CODE / TEXT */ in_array($extension, ['php']) => self::PHP, in_array($extension, ['json']) => self::JSON, in_array($extension, ['xml']) => self::XML, in_array($extension, ['txt', 'log', 'md']) => self::TXT, in_array($extension, ['html', 'htm']) => self::HTML, in_array($extension, ['js', 'mjs', 'cjs']) => self::JS, /* IMAGES */ in_array($extension, [ 'jpg','jpeg','png','gif','webp','bmp','svg','tiff','ico','avif' ]) => self::IMAGE, /* VIDEOS */ in_array($extension, [ 'mp4','webm','mkv','avi','mov','wmv','flv','m4v','3gp' ]) => self::VIDEO, /* DOCUMENTS */ in_array($extension, [ 'pdf','doc','docx','xls','xlsx','ppt','pptx','odt','ods','odp','rtf' ]) => self::DOCUMENT, /* ARCHIVES */ in_array($extension, [ 'zip','rar','7z','tar','gz','bz2','xz','tgz','tar.gz' ]) => self::ARCHIVE, /* CACHE */ $extension === 'cache' => self::CACHE, default => self::FILE }.

Implementation, validation guards and interaction order
/**
     * Resolve enum from extension
     */
    public static function fromExtension(string $extension): self
    {
        $extension = strtolower(trim($extension, '.'));

        return match (true) {

            /* CODE / TEXT */
            in_array($extension, ['php']) => self::PHP,
            in_array($extension, ['json']) => self::JSON,
            in_array($extension, ['xml']) => self::XML,
            in_array($extension, ['txt', 'log', 'md']) => self::TXT,
            in_array($extension, ['html', 'htm']) => self::HTML,
            in_array($extension, ['js', 'mjs', 'cjs']) => self::JS,

            /* IMAGES */
            in_array($extension, [
                'jpg','jpeg','png','gif','webp','bmp','svg','tiff','ico','avif'
            ]) => self::IMAGE,

            /* VIDEOS */
            in_array($extension, [
                'mp4','webm','mkv','avi','mov','wmv','flv','m4v','3gp'
            ]) => self::VIDEO,

            /* DOCUMENTS */
            in_array($extension, [
                'pdf','doc','docx','xls','xlsx','ppt','pptx','odt','ods','odp','rtf'
            ]) => self::DOCUMENT,

            /* ARCHIVES */
            in_array($extension, [
                'zip','rar','7z','tar','gz','bz2','xz','tgz','tar.gz'
            ]) => self::ARCHIVE,

            /* CACHE */
            $extension === 'cache' => self::CACHE,

            default => self::FILE
        };
    }

getDefaultExtension

Source line 79

public function getDefaultExtension(): string

Get canonical extension for this type

Return expressions (including local callbacks): match ($this) { self::PHP => 'php', self::JSON => 'json', self::XML => 'xml', self::TXT => 'txt', self::HTML => 'html', self::JS => 'js', self::CACHE => 'cache', self::IMAGE => 'png', self::VIDEO => 'mp4', self::DOCUMENT => 'pdf', self::ARCHIVE => 'zip', self::FILE => '', }.

Implementation, validation guards and interaction order
/**
     * Get canonical extension for this type
     */
    public function getDefaultExtension(): string
    {
        return match ($this) {
            self::PHP => 'php',
            self::JSON => 'json',
            self::XML => 'xml',
            self::TXT => 'txt',
            self::HTML => 'html',
            self::JS => 'js',
            self::CACHE => 'cache',
            self::IMAGE => 'png',
            self::VIDEO => 'mp4',
            self::DOCUMENT => 'pdf',
            self::ARCHIVE => 'zip',
            self::FILE => '',
        };
    }

matchesExtension

Source line 100

public function matchesExtension(string $extension): bool

Parameters

Parameter Type, modifiers and default Purpose
$extension string $extension Operation input; the exact use, validation and propagation are shown in the implementation trace.

Check if extension belongs to this type

Return expressions (including local callbacks): self::fromExtension($extension) === $this.

Implementation, validation guards and interaction order
/**
     * Check if extension belongs to this type
     */
    public function matchesExtension(string $extension): bool
    {
        return self::fromExtension($extension) === $this;
    }

isBinary

Source line 108

public function isBinary(): bool

Helper checks

Return expressions (including local callbacks): match ($this) { self::IMAGE, self::VIDEO, self::ARCHIVE, self::DOCUMENT => true, default => false, }.

Implementation, validation guards and interaction order
/**
     * Helper checks
     */
    public function isBinary(): bool
    {
        return match ($this) {
            self::IMAGE,
            self::VIDEO,
            self::ARCHIVE,
            self::DOCUMENT => true,
            default => false,
        };
    }

isText

Source line 119

public function isText(): bool

Return expressions (including local callbacks): !$this->isBinary().

Implementation, validation guards and interaction order
public function isText(): bool
    {
        return !$this->isBinary();
    }

Clone this wiki locally