Source: ~/modules/system/traits/ConfigMaker.php

Config Maker Trait Adds configuration based methods to a class

Protected properties

protected string $configPath

Specifies a path to the config directory.

Public methods

public string getConfigPath(string $fileName, mixed $configPath=NULL)

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.

  • string $fileName - File to load.
  • mixed $configPath - Explicitly define a config path.

public string guessConfigPath(string $suffix='')

Guess the package path for the called class.

  • string $suffix - An extra path to attach to the end

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

Guess the package path from a specified class.

  • string $class - Class to guess path from.
  • string $suffix - An extra path to attach to the end

public array|stdClass makeConfig(array $configFile=array(), array $requiredConfig=array())

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

  • array $configFile
  • array $requiredConfig

public stdClass makeConfigFromArray(array $configArray=array())

Makes a config object from an array, making the first level keys properties a new object. Property values are converted to camelCase and are not set if one already exists.

  • array $configArray - Config array.

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

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

  • mixed $configA
  • mixed $configB