Folder::offsetGet()
Gets the file content by its relative path to the folder.
Table of Contents
Description
Folder::offsetGet(mixed $key): ?string;This method is a requirement to be able to implement the ArrayAccess interface and aims to make the object data accessible using array access syntax. You won’t use this method directly, it will be executed automatically when you try to get a file/folder from the folder with array access syntax. This method gets a file/folder using its relative path to the folder. If the path does not exist in the folder, this method returns null.
Example
$folder = new Folder('.\path\to\folder');
test($folder['asdf.txt']); // Returns `null` because file `.\path\to\folder\asdf.txt` does not exist
test($folder['file.txt']); // Returns a `File` instance of `.\path\to\folder\file.txt`
test($folder['folder/123']); // Returns a `Folder` instance of `.\path\to\folder\folder\123`Folder::URL()
Converts private folder path to public URL.
Folder::_()
The dynamic method initiator.
Folder::__call()
Proxy for missing methods.
Folder::__callStatic()
Proxy for missing static methods.
Folder::__construct()
The constructor.
Folder::__get()
Proxy for missing properties.
Folder::__isset()
Checks if a method returns non-null value.
Folder::__serialize()
Provides data to be serialized.
Folder::__toString()
Proxy for the current object, casted as a string.
Folder::__unserialize()
Converts the serialized data back to its object.
Folder::_seal()
Gets the folder permissions as numeric mode.
Folder::_size()
Gets the total sizes of files contained in the folder.
Folder::content()
Nothing.
Folder::count()
Counts the number of files contained in the folder.
Folder::exist()
Checks if the folder exists.
Folder::from()
Object instantiator.
Folder::getIterator()
The external iterator receiver.
Folder::jsonSerialize()
Returns the data to be serialized as JSON.
Folder::name()
Gets the folder name.
Folder::offsetExists()
Checks if a path exists relative to the folder.
Folder::offsetGet()
Gets the file content by its relative path to the folder.
Folder::parent()
Gets the folder’s parent folder.
Folder::route()
Returns the folder’s relative path.
Folder::seal()
Gets the folder permissions as an octal value.
Folder::size()
Gets the total sizes of files contained in the folder in human readable string format.
Folder::stream()
Streams the contents of the folder.
Folder::time()
Gets the folder creation time.
Folder::type()
Nothing.
Folder::x()
Nothing.