PhpStorageInterface
interface PhpStorageInterface (View source)
Stores and loads PHP code.
Each interface function takes $name as a parameter. This is a virtual file name: for example, 'foo.php' or 'some/relative/path/to/foo.php'. The storage implementation may store these as files within the local file system, use a remote stream, combine multiple virtual files into an archive, store them in database records, or use some other storage technique.
Methods
Checks whether the PHP code exists in storage.
Loads PHP code from storage.
Saves PHP code to storage.
Whether this is a writable storage.
Deletes PHP code from storage.
Removes all files in this bin.
Gets the full file path.
Lists all the files in the storage.
Performs garbage collection on the storage.
Details
bool
exists(string $name)
Checks whether the PHP code exists in storage.
load(string $name)
Loads PHP code from storage.
Depending on storage implementation, exists() checks can be expensive, so this function may be called for a file that doesn't exist, and that should not result in errors. This function does not return anything, so it is up to the caller to determine if any code was loaded (for example, check class_exists() or function_exists() for what was expected in the code).
bool
save(string $name, string $code)
Saves PHP code to storage.
bool
writeable()
Whether this is a writable storage.
bool
delete(string $name)
Deletes PHP code from storage.
deleteAll()
Removes all files in this bin.
string|false
getFullPath(string $name)
Gets the full file path.
array
listAll()
Lists all the files in the storage.
garbageCollection()
Performs garbage collection on the storage.
The storage may choose to delete expired or invalidated items.