FileNode
in package
Represents a node in a filesystem, which is either a file, or a directory.
Immutable.
Table of Contents
Properties
- $extension : string
- The extension (according to the file name).
- $fullPath : string
- $iconExtensions : array<string, array<string|int, string>>
- File extensions per FontAwesome icon.
- $kind : string
- $lastModified : DateTime|null
- When the file was last modified. Is `null` when the file node concerns a directory or the time cannot be read.
- $name : string
- $root : string
Methods
- __construct() : mixed
- getExtension() : string
- Extension of file or dir.
- getFileIcon() : string
- Get corresponding FontAwesome file icon.
- getFullPath() : string
- Gets path of parent.
- getKind() : string
- Gets kind.
- getLastModified() : DateTime|null
- Get when the file was last modified.
- getName() : string
- Name of file or dir.
Properties
$extension
The extension (according to the file name).
private
string
$extension
extension according to the filesystem
$fullPath read-only
private
string
$fullPath
$iconExtensions
File extensions per FontAwesome icon.
private
array<string, array<string|int, string>>
$iconExtensions
= [
'fa-file-word' => ['docx', 'docm', 'doc', 'dotx', 'dotm', 'dot', 'odt', 'rtf', 'wpd'],
'fa-file-powerpoint' => ['pptx', 'pptm', 'ppt', 'potx', 'potm', 'pot', 'ppsx', 'ppsm', 'pps', 'odp', 'ods'],
'fa-file-excel' => ['xlsx', 'xlsm', 'xls', 'xlsb', 'xltx', 'xltm', 'xlt'],
'fa-file-csv' => ['csv'],
//Only available as solid icon in free version
'fa-file-pdf' => ['pdf', 'pdfa'],
'fa-file-video' => ['webm', 'mpg', 'mp2', 'mpeg', 'mpe', 'mpv', 'ogg', 'mp4', 'm4p', 'm4v', 'avi', 'wmv', 'mov', 'qt', 'flv', 'swf', 'avchd', 'h264', 'mpeg4'],
'fa-file-audio' => ['3gp', 'aa', 'aac', 'aax', 'act', 'aiff', 'alac', 'amr', 'ape', 'au', 'awb', 'dct', 'dss', 'dvf', 'flac', 'gsm', 'iklax', 'ivs', 'm4a', 'm4b', 'm4p', 'mmf', 'mp3', 'mpc', 'msv', 'nmf', 'nsf', 'ogg, .oga, .mogg', 'opus', 'ra, .rm', 'raw', 'sln', 'tta', 'voc', 'vox', 'wav', 'wma', 'wv', 'webm', '8svx'],
'fa-file-image' => ['ani', 'anim', 'apng', 'art', 'bmp', 'bpg', 'bsave', 'cal', 'cin', 'cpc', 'cpt', 'dds', 'dpx', 'ecw', 'exr', 'fits', 'flic', 'flif', 'fpx', 'gif', 'hdri', 'hevc', 'icer', 'icns', 'ico / cur', 'ics', 'ilbm', 'jbig', 'jbig2', 'jng', 'jpeg', 'jpeg-ls', 'jpeg 2000', 'jpeg xr', 'jpeg xt ', 'jpeg-hdr', 'jpg', 'kra', 'mng', 'miff', 'nrrd', 'pam', 'pbm', 'pgm', 'ppm', 'pnm', 'pcx', 'pgf', 'pictor', 'png', 'psd', 'psb', 'psp', 'qtvr', 'ras', 'rgbe ', 'logluv tiff', 'sgi', 'tga', 'tiff', 'tiff/ep', 'tiff/it', 'ufo', 'ufp', 'wbmp', 'webp', 'xbm', 'xcf', 'xpm', 'xwd'],
'fa-file-archive' => ['.a', 'ar', 'cpio', 'shar', 'LBR', 'iso', 'lbr', 'mar', 'sbx', 'tar', '7z', 's7z', 'ace', 'afa', 'alz', 'apk', 'ar', 'ark', 'arc', 'cdx', 'arj', 'b1', 'b6z', 'ba', 'bh', 'cab', 'car', 'cfs', 'cpt', 'dar', 'dd', 'dgc', 'dmg', 'ear', 'gca', 'ha', 'hki', 'ice', 'jar', 'kgb', 'lzh', 'lha', 'lzx', 'pak', 'partimg', 'paq6', 'paq7', 'paq8', 'pea', 'pim', 'pit', 'qda', 'rar', 'rk', 'sda', 'sea', 'sen', 'sfx', 'shk', 'sit', 'sitx', 'sqx', 'tar.gz', 'tgz', 'tar.Z', 'tar.bz2', 'tbz2', 'tar.lzma', 'tlz', 'tar.xz', 'txz', 'uc', 'uc0', 'uc2', 'ucn', 'ur2', 'ue2', 'uca', 'uha', 'war', 'wim', 'xar', 'xp3', 'yz1', 'zip', 'zipx', 'zoo', 'zpaq', 'zz'],
'fa-file-alt' => ['txt', 'tex', 'text', 'ini', 'md'],
'fa-copy' => ['bak', 'tmp', 'dmp'],
'fa-folder' => ['folder'],
'fa-archive' => ['folder-archive'],
]
$kind read-only
private
string
$kind
$lastModified
When the file was last modified. Is `null` when the file node concerns a directory or the time cannot be read.
private
DateTime|null
$lastModified
= null
$name read-only
private
string
$name
$root read-only
private
string
$root
Methods
__construct()
public
__construct(string $name, string $fullPath, string $kind, string $root) : mixed
Parameters
- $name : string
- $fullPath : string
- $kind : string
- $root : string
getExtension()
Extension of file or dir.
public
getExtension() : string
Return values
string —valid name
getFileIcon()
Get corresponding FontAwesome file icon.
public
getFileIcon() : string
Return values
string —valid FontAwesome 5 icon
getFullPath()
Gets path of parent.
public
getFullPath() : string
Return values
string —valid path
getKind()
Gets kind.
public
getKind() : string
Return values
string —either 'file' or 'dir'
getLastModified()
Get when the file was last modified.
public
getLastModified() : DateTime|null
Return values
DateTime|nullgetName()
Name of file or dir.
public
getName() : string
Return values
string —valid name