ConfigMaker trait adds configuration based methods to a class

Protected Properties

protected string $configPath

configPath specifies a path to the config directory.

Public Methods

public getConfigPath()

public getConfigPath(
    string $fileName,
    mixed $configPath = null
): string 

getConfigPath locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.

public guessConfigPath()

public guessConfigPath(string $suffix = ''): string 

guessConfigPath guesses the package path for the called class.

public guessConfigPathFrom()

public guessConfigPathFrom(string $class, string $suffix = ''): string 

guessConfigPathFrom guesses the package path from a specified class.

public makeConfig()

public makeConfig(
    mixed $configFile = [],
    array $requiredConfig = []
): object 

makeConfig reads the contents of the supplied file and applies it to this object.

public makeConfigFromArray()

public makeConfigFromArray(array $configArray = []): stdClass 

makeConfigFromArray makes a config object from an array, making the first level keys properties of a new object.

public mergeConfig()

public mergeConfig(mixed $configA, mixed $configB): stdClass 

mergeConfig merges two configuration sources, either prepared or not, and returns them as a single configuration object.

Protected Methods

protected getConfigValueFrom()

protected getConfigValueFrom($configObj, $name = null, $default = null): void

getConfigValueFrom will apply the config getter convention