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

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 53
__construct(Factory $factory)

Class constructor. Sets factory and root object on init.

Parameters

Factory $factory

at line 65
setFactory(Factory $factory)

Sets Factory instance

Parameters

Factory $factory

at line 75
Factory factory()

Returns Factory instance

Return Value

Factory

at line 85
Root root()

Returns Root instance

Return Value

Root

at line 99
Node nodeAt(string $path)

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

Parameters

string $path

Return Value

Node

Exceptions

NotFoundException

at line 122
bool hasNodeAt(string $path)

Checks whether filesystem has Node at given path

Parameters

string $path

Return Value

bool

at line 143
Directory directoryAt(string $path)

Returns directory at given path

Parameters

string $path

Return Value

Directory

Exceptions

NotDirectoryException
NotFoundException

at line 164
File fileAt(string $path)

Returns file at given path

Parameters

string $path

Return Value

File

Exceptions

NotFileException
NotFoundException

at line 186
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 244
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 267
createStructure(array $structure, string $parent = '/')

Creates struture

Parameters

array $structure
string $parent

Exceptions

NotFoundException

at line 287
move(string $fromPath, string $toPath)

Moves Node from source to destination

Parameters

string $fromPath
string $toPath

Exceptions

RuntimeException

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

Removes node at $path

Parameters

string $path
bool $recursive

Exceptions

RuntimeException

at line 348
PermissionHelper getPermissionHelper(Node $node)

Returns PermissionHelper with given node in context

Parameters

Node $node

Return Value

PermissionHelper

at line 358
setPermissionHelper(PermissionHelper $permissionHelper)

Sets permission helper instance

Parameters

PermissionHelper $permissionHelper