The adapter provide direct access to the native filesystem.

package filicious-core
author Christian Schiffler
author Tristan Lins
author Oliver Hoff

 Methods

Write contents to a file. Returns <em>false</em> on error (e.a. if file is a directory).

appendContents(\Filicious\Internals\Pathname $pathname, string $content, bool $create) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$content

string

$create

bool

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists and $create is set to false
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Copies file

copyFrom(\Filicious\Internals\Pathname $dstPathname, \Filicious\Internals\Pathname $srcPathname, int $flags) : static
TODO list valid flags

Parameters

$dstPathname

\Filicious\Internals\Pathname

The full abstracted pathname

$srcPathname

\Filicious\Internals\Pathname

The full abstracted pathname of the source from which will be copied

$flags

int

Flags to control the operations behavior

Exceptions

\Filicious\Exception\FileNotFoundException If the file does already exists and the OVERWRITE_REJECT flag is set
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Copies file

copyTo(\Filicious\Internals\Pathname $srcPathname, \Filicious\Internals\Pathname $dstPathname, int $flags) : static
TODO list valid flags

Parameters

$srcPathname

\Filicious\Internals\Pathname

The full abstracted pathname

$dstPathname

\Filicious\Internals\Pathname

The full abstracted destination pathname

$flags

int

Flags to control the operations behavior

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

TODO

count(\Filicious\Internals\Pathname $pathname, array $filter) : int

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$filter

array

An array of filters to apply

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists or is not a directory
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

intThe amount of child nodes of the pathname

Makes directory

createDirectory(\Filicious\Internals\Pathname $pathname, bool $parents) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$parents

bool

Exceptions

\Filicious\Exception\FileNotFoundException If the file does already exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Create new empty file.

createFile(\Filicious\Internals\Pathname $pathname, bool $parents) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$parents

bool

Exceptions

\Filicious\Exception\FileNotFoundException If the file does already exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Delete a file or directory.

delete(\Filicious\Internals\Pathname $pathname, bool $recursive, bool $force) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$recursive

bool

$force

bool

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Checks whether a file or directory exists.

exists(\Filicious\Internals\Pathname $pathname) : bool

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

bool

Returns the time of the file named by the given pathname was accessed last time.

getAccessTime(\Filicious\Internals\Pathname $pathname) : \DateTime

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

Get contents of the file. Returns <em>null</em> if file does not exists and <em>false</em> on error (e.a. if file is a directory).

getContents(\Filicious\Internals\Pathname $pathname) : string

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

string

Returns the time of the file named by the given pathname at which it was created.

getCreationTime(\Filicious\Internals\Pathname $pathname) : \DateTime

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

\DateTimeThe creation time of the file

Returns the filesystem this adapter belongs to.

getFilesystem() : \Filicious\Filesystem

Returns

\Filicious\FilesystemThe filesystem this adapter belongs to

Get the group of the file named by the given pathname.

getGroup(\Filicious\Internals\Pathname $pathname) : string | int

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

stringint

TODO

getIterator(\Filicious\Internals\Pathname $pathname, array $filter) : \Iterator

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$filter

array

An array of filters to apply

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists or is not a directory
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

\IteratorAn iterator which iterates over the matched child nodes

Get the mode of the file named by the given pathname.

getMode(\Filicious\Internals\Pathname $pathname) : int

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

intTODO mode representation type?

Returns the time of the file named by the given pathname was modified last time.

getModifyTime(\Filicious\Internals\Pathname $pathname) : \DateTime

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

\DateTimeThe modify time of the file

Get the owner of the file named by the given pathname.

getOwner(\Filicious\Internals\Pathname $pathname) : string | int

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

stringint

Returns the parent adapter of this adapter, if any.

getParentAdapter() : \Filicious\Internals\Adapter | null

Returns

\Filicious\Internals\AdapternullThe parent adapter

Returns the root adapter of the filesystem this adapter belongs to.

getRootAdapter() : \Filicious\Internals\Adapter

Returns

\Filicious\Internals\AdapterThe filesystems root adapter

Get the size of the file named by the given pathname.

getSize(\Filicious\Internals\Pathname $pathname, bool $recursive) : int

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$recursive

bool

Whether or not to calculate the size of directories.

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

intThe size of the file

Gets an stream for the file. May return <em>null</em> if streaming is not supported.

getStream(\Filicious\Internals\Pathname $pathname) : \Filicious\Stream

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

Get the real url, e.g. file:/real/path/to/file to the pathname.

getStreamURL(\Filicious\Internals\Pathname $pathname) : string

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

string

Tests whether the file denoted by the given pathname exists and is a directory.

isDirectory(\Filicious\Internals\Pathname $pathname) : bool

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

boolTrue, if the file exists and is a directory; otherwise false

Tests whether the file named by the given pathname is executeable.

isExecutable(\Filicious\Internals\Pathname $pathname) : bool

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

boolTrue, if the file exists and is executable; otherwise false

Tests whether the file denoted by the given pathname exists and is a file.

isFile(\Filicious\Internals\Pathname $pathname) : bool

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

boolTrue, if the file exists and is a file; otherwise false

Tests whether the file named by the given pathname is readable.

isReadable(\Filicious\Internals\Pathname $pathname) : bool

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

boolTrue, if the file exists and is readable; otherwise false

Tests whether the file named by the given pathname is writable.

isWritable(\Filicious\Internals\Pathname $pathname) : bool

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

boolTrue, if the file exists and is writable; otherwise false

Returns all filenames of all (direct) children.

ls(\Filicious\Internals\Pathname $pathname) : \Filicious\File[]

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists or is not a directory
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

Renames a file or directory

moveFrom(\Filicious\Internals\Pathname $dstPathname, \Filicious\Internals\Pathname $srcPathname, int $flags) : static
TODO list valid flags

Parameters

$dstPathname

\Filicious\Internals\Pathname

The full abstracted pathname

$srcPathname

\Filicious\Internals\Pathname

The full abstracted pathname of the source from which will be copied

$flags

int

Flags to control the operations behavior

Exceptions

\Filicious\Exception\FileNotFoundException If the file does already exists and the OVERWRITE_REJECT flag is set
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Renames a file or directory

moveTo(\Filicious\Internals\Pathname $srcPathname, \Filicious\Internals\Pathname $dstPathname, int $flags) : static
TODO list valid flags

Parameters

$srcPathname

\Filicious\Internals\Pathname

The full abstracted pathname

$dstPathname

\Filicious\Internals\Pathname

The full abstracted destination pathname

$flags

int

Flags to control the operations behavior

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Resolve the local path

resolveLocal(\Filicious\Internals\Pathname $pathname, \Filicious\Internals\Adapter $localAdapter, string $local) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The pathname to resolve local path from

$localAdapter

\Filicious\Internals\Adapter

The local adapter

$local

string

The adapter local path

Returns

static

Sets the access time of the file named by the given pathname.

setAccessTime(\Filicious\Internals\Pathname $pathname, \DateTime $accessTime) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$accessTime

\DateTime

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Write contents to a file. Returns <em>false</em> on error (e.a. if file is a directory).

setContents(\Filicious\Internals\Pathname $pathname, string $content, bool $create) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$content

string

$create

bool

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists and $create is set to false
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Set the filesystem this adapter belongs to.

setFilesystem(\Filicious\Filesystem $fs) : static

Parameters

$fs

\Filicious\Filesystem

The filesystem this adapter belongs to.

Returns

static

Change the group of the file named by the given pathname.

setGroup(\Filicious\Internals\Pathname $pathname, mixed $group) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$group

mixed

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Set the mode of the file named by the given pathname.

setMode(\Filicious\Internals\Pathname $pathname, int $mode) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$mode

int

TODO mode representation type?

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Sets the modify time of the file named by the given pathname.

setModifyTime(\Filicious\Internals\Pathname $pathname, \DateTime $modifyTime) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$modifyTime

\DateTime

The new modify time to set

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Set the owner of the file named by the given pathname.

setOwner(\Filicious\Internals\Pathname $pathname, string|int $user) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$user

stringint

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Set the parent adapter for this adapter.

setParentAdapter(\Filicious\Internals\Adapter|null $parent) : static

Parameters

$parent

\Filicious\Internals\Adapternull

The parent adapter

Returns

static

Sets access and modify time of file, optionally creating the file, if it does not exists yet.

touch(\Filicious\Internals\Pathname $pathname, \DateTime $modifyTime, \DateTime $accessTime, bool $create) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$modifyTime

\DateTime

The new modify time to set

$accessTime

\DateTime

The new access time to set; If null then $modifyTime will be used

$create

bool

Whether to create the file, if it does not already exists

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists and $create is set to false
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static

Truncate a file to a given length. Returns the new length or <em>false</em> on error (e.a. if file is a directory).

truncate(\Filicious\Internals\Pathname $pathname, int $size) : static

Parameters

$pathname

\Filicious\Internals\Pathname

The full abstracted pathname

$size

int

Exceptions

\Filicious\Exception\FileNotFoundException If the file does not exists
\Filicious\Exception\AdapterException If the access to the underlying filesystem fails due to technical reasons like connection problems or timeouts

Returns

static