LockableFile
class LockableFile
Properties
| protected resource | $handle | The file resource. |
|
| protected string | $path | The file path. |
|
| protected bool | $isLocked | Indicates if the file is locked. |
Methods
Create a new File instance.
Create the file's directory if necessary.
Create the file resource.
Read the file contents.
Get the file size.
Determine whether the open file has been unlinked.
Write to the file.
Truncate the file.
Get a shared lock on the file.
Get an exclusive lock on the file.
Release the lock on the file.
Close the file.
Details
at line 34
__construct(string $path, string $mode)
Create a new File instance.
at line 45
protected void
ensureDirectoryExists(string $path)
Create the file's directory if necessary.
at line 59
protected void
createResource(string $path, string $mode)
Create the file resource.
at line 73
string
read(int|null $length = null)
Read the file contents.
at line 87
int
size()
Get the file size.
at line 101
bool
wasDeleted()
Determine whether the open file has been unlinked.
at line 117
LockableFile
write(string $contents)
Write to the file.
at line 141
LockableFile
truncate()
Truncate the file.
at line 161
LockableFile
getSharedLock(bool $block = false)
Get a shared lock on the file.
at line 179
LockableFile
getExclusiveLock(bool $block = false)
Get an exclusive lock on the file.
at line 195
LockableFile
releaseLock()
Release the lock on the file.
at line 209
bool
close()
Close the file.