trait ResourceExistenceChecker (View source)

Methods

bool
checkResources(string|string[] $resources, string $type = 'fileAndDir')

Checks if the given input is a file or folder.

bool
checkResource(string $resource, string $type)

Checks a single resource, file or directory.

checkSourceAndTargetResource(string|array $resources)

Convenience method to check the often uses "source => target" file / folder arrays.

bool
isDir(string $directory)

Wrapper method around phps is_dir()

bool
isFile(string $file)

Wrapper method around phps file_exists()

Details

protected bool checkResources(string|string[] $resources, string $type = 'fileAndDir')

Checks if the given input is a file or folder.

Parameters

string|string[] $resources
string $type

Allowed values: "file", "dir", "fileAndDir"

Return Value

bool

True if no errors were encountered otherwise false.

protected bool checkResource(string $resource, string $type)

Checks a single resource, file or directory.

It will print an error as well on the console.

Parameters

string $resource

File or folder.

string $type

Allowed values: "file", "dir", "fileAndDir".

Return Value

bool

protected checkSourceAndTargetResource(string|array $resources)

Convenience method to check the often uses "source => target" file / folder arrays.

Parameters

string|array $resources

protected bool isDir(string $directory)

Wrapper method around phps is_dir()

Parameters

string $directory

Return Value

bool

protected bool isFile(string $file)

Wrapper method around phps file_exists()

Parameters

string $file

Return Value

bool