class Container

Class to hold the filesystem structure as object representation. It also provides access and factory methods for file system management.

An instance of Container is registered as a default stream options when FileSystem class is instantiated - it is later used by streamWrapper implementation to interact with underlying object representation.

Methods

__construct(Factory $factory)

Class constructor. Sets factory and root object on init.

setFactory(Factory $factory)

Sets Factory instance

factory()

Returns Factory instance

root()

Returns Root instance

nodeAt(string $path)

Returns filesystem Node|Directory|File|Root at given path.

bool
hasNodeAt(string $path)

Checks whether filesystem has Node at given path

directoryAt(string $path)

Returns directory at given path

fileAt(string $path)

Returns file at given path

createDir(string $path, bool $recursive = false, null|integer $mode = null)

Creates Directory at given path.

createLink(string $path, string $destination)

Creates link at given path

createFile(string $path, string|null $data = null)

Creates file at given path

createStructure(array $structure, string $parent = '/')

Creates struture

bool
move(string $fromPath, string $toPath)

Moves Node from source to destination

remove(string $path, bool $recursive = false)

Removes node at $path

getPermissionHelper(Node $node)

Returns PermissionHelper with given node in context

setPermissionHelper(PermissionHelper $permissionHelper)

Sets permission helper instance

Details

at line 50
__construct(Factory $factory)

Class constructor. Sets factory and root object on init.

Parameters

Factory $factory

at line 62
setFactory(Factory $factory)

Sets Factory instance

Parameters

Factory $factory

at line 72
Factory factory()

Returns Factory instance

Return Value

Factory

at line 82
Root root()

Returns Root instance

Return Value

Root

at line 96
Node nodeAt(string $path)

Returns filesystem Node|Directory|File|Root at given path.

Parameters

string $path

Return Value

Node

Exceptions

NotFoundException

at line 119
bool hasNodeAt(string $path)

Checks whether filesystem has Node at given path

Parameters

string $path

Return Value

bool

at line 140
Directory directoryAt(string $path)

Returns directory at given path

Parameters

string $path

Return Value

Directory

Exceptions

NotDirectoryException
NotFoundException

at line 161
File fileAt(string $path)

Returns file at given path

Parameters

string $path

Return Value

File

Exceptions

NotFileException
NotFoundException

at line 183
Directory createDir(string $path, bool $recursive = false, null|integer $mode = null)

Creates Directory at given path.

Parameters

string $path
bool $recursive
null|integer $mode

Return Value

Directory

Exceptions

NotFoundException

Creates link at given path

Parameters

string $path
string $destination

Return Value

Link

at line 241
File createFile(string $path, string|null $data = null)

Creates file at given path

Parameters

string $path
string|null $data

Return Value

File

Exceptions

RuntimeException

at line 264
createStructure(array $structure, string $parent = '/')

Creates struture

Parameters

array $structure
string $parent

Exceptions

NotFoundException

at line 284
bool move(string $fromPath, string $toPath)

Moves Node from source to destination

Parameters

string $fromPath
string $toPath

Return Value

bool

Exceptions

RuntimeException

at line 328
remove(string $path, bool $recursive = false)

Removes node at $path

Parameters

string $path
bool $recursive

Exceptions

RuntimeException

at line 346
PermissionHelper getPermissionHelper(Node $node)

Returns PermissionHelper with given node in context

Parameters

Node $node

Return Value

PermissionHelper

at line 356
setPermissionHelper(PermissionHelper $permissionHelper)

Sets permission helper instance

Parameters

PermissionHelper $permissionHelper