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
__construct(string $path, string $mode)
Create a new File instance.
void
ensureDirectoryExists(string $path)
Create the file's directory if necessary.
void
createResource(string $path, string $mode)
Create the file resource.
string
read(int|null $length = null)
Read the file contents.
int
size()
Get the file size.
write(string $contents)
Write to the file.
truncate()
Truncate the file.
getSharedLock(bool $block = false)
Get a shared lock on the file.
getExclusiveLock(bool $block = false)
Get an exclusive lock on the file.
releaseLock()
Release the lock on the file.
bool
close()
Close the file.
Details
at line 33
__construct(string $path, string $mode)
Create a new File instance.
at line 44
protected void
ensureDirectoryExists(string $path)
Create the file's directory if necessary.
at line 58
protected void
createResource(string $path, string $mode)
Create the file resource.
at line 72
string
read(int|null $length = null)
Read the file contents.
at line 86
int
size()
Get the file size.
at line 100
LockableFile
write(string $contents)
Write to the file.
at line 122
LockableFile
truncate()
Truncate the file.
at line 142
LockableFile
getSharedLock(bool $block = false)
Get a shared lock on the file.
at line 160
LockableFile
getExclusiveLock(bool $block = false)
Get an exclusive lock on the file.
at line 174
LockableFile
releaseLock()
Release the lock on the file.
at line 188
bool
close()
Close the file.