LocalFileReader
in package
implements
FileReader
Description of LocalFileReader.
Table of Contents
Interfaces
- FileReader
- Interface describing the operations required for reading browsing files (read-only).
Properties
- $root : string
- $validFilepath : string
Methods
- __construct() : mixed
- downloadFile() : bool|Stream
- Either redirects the user to a location to download the file in $path or directly sends this file to the user. Returns false on failure.
- isAllowed() : bool
- Returns whether the given $path is allowed to be accessed.
- isDir() : bool
- Returns whether the given $path is valid and is a directory.
- listDir() : array<string|int, FileNode>|null
- Return an array of all files and subdirectories in the given directory.
- interpretDirContent() : false|string
- isValidPathName() : bool
Properties
$root read-only
private
string
$root
$validFilepath read-only
private
string
$validFilepath
Methods
__construct()
public
__construct(string $root, string $validFilepath) : mixed
Parameters
- $root : string
- $validFilepath : string
downloadFile()
Either redirects the user to a location to download the file in $path or directly sends this file to the user. Returns false on failure.
public
downloadFile(string $path) : bool|Stream
Parameters
- $path : string
Return values
bool|StreamisAllowed()
Returns whether the given $path is allowed to be accessed.
public
isAllowed(string $path) : bool
Parameters
- $path : string
Return values
boolisDir()
Returns whether the given $path is valid and is a directory.
public
isDir(string $path) : bool
Parameters
- $path : string
Return values
boollistDir()
Return an array of all files and subdirectories in the given directory.
public
listDir(string $path) : array<string|int, FileNode>|null
Parameters
- $path : string
Return values
array<string|int, FileNode>|nullinterpretDirContent()
protected
interpretDirContent(string $dirContent, string $fullPath) : false|string
Parameters
- $dirContent : string
- $fullPath : string
Return values
false|stringisValidPathName()
protected
isValidPathName(string $path) : bool
Parameters
- $path : string