class ModuleManifest (View source)

A utility class which builds a manifest of configuration items

Traits

Provides extensions to this object to integrate it with standard config API methods.

Constants

PROJECT_KEY

Config options

module_priority array

List of modules sorted by priority

project string

Project name

Properties

protected string $base

The base path used when building the manifest

protected string $cacheKey

A string to prepend to all cache keys to ensure all keys are unique to just this $base

protected CacheFactory $cacheFactory

Factory to use to build cache

protected CacheInterface $cache
protected Module[] $modules

List of all modules.

Methods

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

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

Constructs and initialises a new configuration object, either loading from the cache or re-scanning for classes.

public
addModule(string $path)

Adds a path as a module

public
bool
moduleExists(string $name)

Returns true if the passed module exists

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

No description

public
activateConfig()

Includes all of the php _config.php files found by this manifest.

public
regenerate(bool $includeTests = false)

Completely regenerates the manifest file. Scans through finding all php _config.php and yaml _config/*.ya?ml files,parses the yaml files into fragments, sorts them and figures out what values need to be checked to pick the correct variant.

public
getModule(string $name)

Get module by name

public
Module[]
getModules()

Get modules found

public
sort()

Sort modules sorted by priority

public
getModuleByPath(string $path)

Get module that contains the given path

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

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

Constructs and initialises a new configuration object, either loading from the cache or re-scanning for classes.

Parameters

string $base

The project base path.

CacheFactory $cacheFactory

Cache factory to use

addModule(string $path)

Adds a path as a module

Parameters

string $path

bool moduleExists(string $name)

Returns true if the passed module exists

Parameters

string $name

Either full composer name or short name

Return Value

bool

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

No description

Parameters

bool $includeTests
bool $forceRegen

Force the manifest to be regenerated.

activateConfig()

Includes all of the php _config.php files found by this manifest.

regenerate(bool $includeTests = false)

Completely regenerates the manifest file. Scans through finding all php _config.php and yaml _config/*.ya?ml files,parses the yaml files into fragments, sorts them and figures out what values need to be checked to pick the correct variant.

Does not build the actual variant

Parameters

bool $includeTests

Module getModule(string $name)

Get module by name

Parameters

string $name

Return Value

Module

Module[] getModules()

Get modules found

Return Value

Module[]

sort()

Sort modules sorted by priority

Module getModuleByPath(string $path)

Get module that contains the given path

Parameters

string $path

Full filesystem path to the given file

Return Value

Module

The module, or null if not a path in any module