$files
$files : array
InMemory Adapter for Filesystem.
This class provides an in-memory file storage system, allowing for the temporary storage and management of files. It is primarily used for testing purposes where persistence is not required. All files are stored in memory, making it a lightweight and fast alternative to file-based storage solutions.
__construct(array $files = []) : void
Constructor for the InMemory adapter.
Initializes the in-memory filesystem adapter with an optional array of files. The provided files can be in the form of strings or associative arrays containing 'content' and optional 'mtime' (last modified time). If no files are provided, the adapter will start with an empty file storage.
array | $files | An optional array of files to initialize the adapter with. Each file can be represented as a string or an associative array with 'content' and optional 'mtime'. |
setFile(string $key, string|null $content = null, int|null $mtime = null) : void
Defines a single file in memory.
string | $key | The unique key for the file. |
string|null | $content | The content of the file. |
int|null | $mtime | The last modified time (automatically set to now if NULL). |
write(string $key, string $content, array $metadata = null) : int|bool
Writes the given content into the file.
string | $key | The key or path of the file to write. |
string | $content | The content to write into the file. |
array | $metadata |
The number of bytes written or false on failure.