class ThemeManifest implements ThemeList (View source)

A class which builds a manifest of all themes (which is really just a directory called "templates")

Constants

TEMPLATES_DIR

Properties

protected string $base

Base path

protected string $project

Path to application code

protected CacheInterface $cache Cache
protected string $cacheKey

Cache key

protected string[] $themes

List of theme root directories

protected CacheFactory $cacheFactory

Methods

public
__construct(string $base, string $project = null, CacheFactory $cacheFactory = null)

Constructs a new template manifest. The manifest is not actually built or loaded from cache until needed.

public
init(bool $includeTests = false, bool $forceRegen = false)

No description

public
string
getBase()

No description

public
string
getCacheKey(bool $includeTests = false)

Generate a unique cache key to avoid manifest cache collisions.

public
array
getThemes()

No description

public
regenerate(bool $includeTests = false)

Regenerates the manifest by scanning the base path.

public
handleDirectory(string $basename, string $pathname, int $depth)

Add a directory to the manifest

public
$this
setProject(string $project)

Sets the project

Details

__construct(string $base, string $project = null, CacheFactory $cacheFactory = null)

Constructs a new template manifest. The manifest is not actually built or loaded from cache until needed.

Parameters

string $base

The base path.

string $project

Path to application code

CacheFactory $cacheFactory

Cache factory to generate backend cache with

init(bool $includeTests = false, bool $forceRegen = false)

No description

Parameters

bool $includeTests

Include tests in the manifest

bool $forceRegen

Force the manifest to be regenerated.

string getBase()

No description

Return Value

string

string getCacheKey(bool $includeTests = false)

Generate a unique cache key to avoid manifest cache collisions.

We compartmentalise based on the base path, the given project, and whether or not we intend to include tests.

Parameters

bool $includeTests

Return Value

string

array getThemes()

No description

Return Value

array

regenerate(bool $includeTests = false)

Regenerates the manifest by scanning the base path.

Parameters

bool $includeTests

handleDirectory(string $basename, string $pathname, int $depth)

Add a directory to the manifest

Parameters

string $basename
string $pathname
int $depth

$this setProject(string $project)

Sets the project

Parameters

string $project

Return Value

$this