A generic file object.
Methods
__construct()
__construct(\Filicious\Internals\Pathname $pathname)
Return a stream url or pathname, if streaming is not supported.
__toString() : string
Append contents to the file.
appendContents(string $content, bool $create) : \Filicious\File
API
Parameters
$content
string
$create
bool
Exceptions
Returns
Copy this file to another destination.
copyTo(\Filicious\File $destination, bool $recursive, int $overwrite, bool $createParents) : \Filicious\File
API
Parameters
$recursive
bool
$overwrite
int
$createParents
bool
Exceptions
Returns
Count all children of this directory.
count(int|string|\Closure|callable $filter, $_) : int
API
Parameters
$filter
int
string
\Closure
callable
Variable list of filters.
- Flags File::LIST_*
- Glob pattern
- Callables
$_
Exceptions
Returns
int
Create a new directory.
createDirectory(bool $createParents) : \Filicious\File
API
Parameters
$createParents
bool
Returns
Create an empty file.
createFile(bool $createParents) : \Filicious\File
API
Parameters
$createParents
bool
Returns
Delete a file or directory.
delete(bool $recursive, bool $force) : \Filicious\File
API
Parameters
$recursive
bool
$force
bool
Exceptions
Returns
Check if file exists.
exists() : bool
API
Returns the date and time at which the file was accessed last time.
getAccessTime() : \DateTime
API
Returns the basename of this file, which is the string after the last
forward slash of the pathname of this file.
getBasename(string $suffix) : string
API
If the basename ends with the given suffix, it will be truncated off
of the end of the basename.
Parameters
$suffix
string
The suffix to truncate
Returns
string
The basename
Get contents of the file.
getContents() : string
API
Exceptions
Returns
string
Returns the date and time at which the file was created.
getCreationTime() : \DateTime
API
Return the dirname or parent name.
getDirname() : string
API
Return the extension of the filename.
getExtension() : string
API
May return an empty string, if filename has no extension.
Returns
string
Return the group of the file.
getGroup() : int | string
API
Exceptions
Returns
int
string
Get an iterator for this directory.
getIterator(int|string|\Closure|callable $filter, $_) : \Iterator
API
Parameters
$filter
int
string
\Closure
callable
Variable list of filters.
- Flags File::LIST_*
- Glob pattern
- Callables
$_
Returns
Return the permission mode of the file.
getMode() : int
API
Returns the time at which the file was modified last time.
getModifyTime() : \DateTime
API
Return the owner of the file.
getOwner() : int | string
API
Exceptions
Returns
int
string
Return the parent file object.
getParent() : \Filicious\File | null
API
May return null if called on the root "/" node.
Returns
Returns the full abstracted pathname of this file within the containing
filesystem.
getPathname() : string
API
A pathname always starts with a forward slash and never ends with one.
The exception is the root of the filesystem, which returns the empty
string.
Returns
string
The full abstracted pathname
Returns the size of the file.
getSize($recursive) : int
API
Parameters
$recursive
Exceptions
Returns
int
The file size
Get a streaming url to the file.
getStreamURL() : string
API
Return a plugin for the filesystem.
hasPlugin(string $name) : bool
API
Parameters
$name
string
Returns
bool
INTERNAL USE ONLY
internalPathname() : \Filicious\Internals\Pathname
internal |
Used to access the internal API.
This is formally used within adapters or plugins. |
Returns
Checks if the file is a directory.
isDirectory() : bool
API
Returns
bool
True if the file exists and is a directory; otherwise false
Check if file is executable.
isExecutable() : bool
API
Checks if the file is a file.
isFile() : bool
API
Returns
bool
True if the file exists and is a file; otherwise false
Check if file is readable.
isReadable() : bool
API
Check if file is writable.
isWritable() : bool
API
List all children of this directory.
ls(int|string|\Closure|callable $filter, $_) : \Filicious\File[]
API
Parameters
$filter
int
string
\Closure
callable
Variable list of filters.
- Flags File::LIST_*
- Glob pattern
- Callables
$_
Exceptions
Returns
Move this file to another destination.
moveTo(\Filicious\File $destination, int $overwrite, bool $createParents) : \Filicious\File
API
Parameters
$overwrite
int
$createParents
bool
Exceptions
Returns
Set the date and time at which the file was accessed last time.
setAccessTime(int|string|\DateTime $accessTime) : \Filicious\File
API
The given $accessTime parameter is converted to a \DateTime object via
Util::createDateTime.
Parameters
$accessTime
int
string
\DateTime
The new access time
Exceptions
Returns
Set contents of the file.
setContents(string $content, bool $create) : \Filicious\File
API
Parameters
$content
string
$create
bool
Exceptions
Returns
Set the group of the file.
setGroup(string|int $group) : \Filicious\File
API
Parameters
$group
string
int
Exceptions
Returns
Set the permission mode of the file.
setMode(int $mode) : \Filicious\File
API
Parameters
$mode
int
Exceptions
Returns
Set the date and time at which the file was modified last time.
setModifyTime(int|string|\DateTime $modifyTime) : static
API
The given $modifyTime parameter is converted to a \DateTime object via
Util::createDateTime.
Parameters
$modifyTime
int
string
\DateTime
The new modify time
Exceptions
Returns
static
Set the owner of the file.
setOwner(string|int $user) : \Filicious\File
API
Parameters
$user
string
int
Exceptions
Returns
Set the date and time at which the file was modified and / or accessed
last time.
touch(int|string|\DateTime $modifyTime, int|string|\DateTime $accessTime, bool $create) : void
API
The given $time and $atime parameters are converted to \DateTime objects
via Util::createDateTime, with the one exception, that if $atime parameter
is set to null, then the date and time given in the $time parameter will
be used for $atime.
Parameters
$modifyTime
int
string
\DateTime
The new modify time
$accessTime
int
string
\DateTime
The new access time; If null then $time will be used
$create
bool
Whether to create the file, if it does not already
exists
Exceptions
Truncate file to a given size.
truncate(int $size) : static
API
Parameters
$size
int
Exceptions
Returns
static
Properties
Constants
List everything (LIST_HIDDEN | LIST_VISIBLE | LIST_FILES | LIST_DIRECTORIES | LIST_LINKS | LIST_OPAQUE)
LIST_ALL
API
Return only directories.
LIST_DIRECTORIES
API
Return only files.
LIST_FILES
API
Return hidden files (starting with ".")
LIST_HIDDEN
API
Return only links.
LIST_LINKS
API
List non-links.
LIST_OPAQUE
API
List recursive.
LIST_RECURSIVE
API
Return non-hidden (not starting with ".")
LIST_VISIBLE
API
<p>Flag for file operations, which involve a file target
destination, to merge the operations file source with the operations
file target destination.</p>
OPERATION_MERGE : int
API
<p>Flag for file operations, which involve a file target
destination, indicating that missing parent directories of the
operations file target destination should be created before the
execution of the operation is done</p>
OPERATION_PARENTS : int
API
<p>Flag for file operations to apply the execution recrusivly, if
the file being operated on is a directory.</p>
OPERATION_RECURSIVE : int
API
<p>Flag for file operations, which involve a file target
destination, to reject the execution of the operation, if the
operations file target destination already exists. This flag
overrules the OPERATION_REPLACE flag.</p>
OPERATION_REJECT : int
API
<p>Flag for file operations, which involve a file target
destination, to replace the target destination.</p>
OPERATION_REPLACE : int
API