class ModuleResource (View source)

This object represents a single resource file attached to a module, and can be used as a reference to this to be later turned into either a URL or file path.

Properties

protected Module $module
protected string $relativePath

Path to this resource relative to the module (no leading slash)

protected ModuleResource[] $resources

Nested resources for this parent resource

Methods

public
__construct(Module $module, string $relativePath)

ModuleResource constructor.

public
string
getPath()

Return the full filesystem path to this resource.

public
string
getRelativePath()

Get the path of this resource relative to the base path.

public
string
getURL()

Public URL to this resource.

public
mixed
Link()

Synonym for getURL() for APIs that expect a Link method

public
bool
exists()

Determine if this resource exists

public
string
__toString()

Get relative path

public
getModule()

No description

public
getRelativeResource(string $path)

Get nested resource relative to this.

Details

__construct(Module $module, string $relativePath)

ModuleResource constructor.

Parameters

Module $module
string $relativePath

string getPath()

Return the full filesystem path to this resource.

Note: In the case that this resource is mapped to the _resources folder, this will return the original rather than the copy / symlink.

Return Value

string

Path with no trailing slash E.g. /var/www/module

string getRelativePath()

Get the path of this resource relative to the base path.

Note: In the case that this resource is mapped to the _resources folder, this will return the original rather than the copy / symlink.

Return Value

string

Relative path (no leading /)

string getURL()

Public URL to this resource.

Note: May be either absolute url, or root-relative url

In the case that this resource is mapped to the _resources folder this will be the mapped url rather than the original path.

Return Value

string

Synonym for getURL() for APIs that expect a Link method

Return Value

mixed

bool exists()

Determine if this resource exists

Return Value

bool

string __toString()

Get relative path

Return Value

string

Module getModule()

No description

Return Value

Module

ModuleResource getRelativeResource(string $path)

Get nested resource relative to this.

Note: Doesn't support .. or . relative syntax

Parameters

string $path

Return Value

ModuleResource