class PathResolver (View source)

A class to resolve and manage paths. Paths defined here are allowed to have variables within them.

For example: "files" folder is within the web directory so it is defined as "%web%/files". This allows the web directory to be changed and the files path does not have to be redefined.

Properties

protected array $paths

Methods

static array
defaultPaths(string $public)

Default paths for Bolt installation.

__construct(string $root, string $themeName = '', string $public = 'public')

No description

void
define(string $name, string $path)

Define a path, or really an alias/variable.

string
resolve(string $path, bool $absolute = true, $additional = null)

Resolve a path.

Collection
resolveAll()

No description

string|null
raw(string $name)

Returns the raw path definition for the name given.

array
rawAll()

Returns all path names and their raw definitions.

array
names()

Returns the names of all paths.

Details

static array defaultPaths(string $public)

Default paths for Bolt installation.

Parameters

string $public

Return Value

array

__construct(string $root, string $themeName = '', string $public = 'public')

Parameters

string $root
string $themeName
string $public

Exceptions

ConfigurationException

void define(string $name, string $path)

Define a path, or really an alias/variable.

Parameters

string $name
string $path

Return Value

void

Exceptions

ConfigurationException

string resolve(string $path, bool $absolute = true, $additional = null)

Resolve a path.

Examples: - %web%/files - A path with variables. - files - A previously defined variable. - foo/bar - A relative path that will be resolved against the root path. - /tmp - An absolute path will be returned as is.

Parameters

string $path
bool $absolute
$additional

Return Value

string

Exceptions

ConfigurationException

Collection resolveAll()

Return Value

Collection

string|null raw(string $name)

Returns the raw path definition for the name given.

Parameters

string $name

Return Value

string|null

array rawAll()

Returns all path names and their raw definitions.

Return Value

array

array names()

Returns the names of all paths.

Return Value

array