Parser class abstract
Framework\Config\Parsers\Parser
Class Parser.
Defined in libraries/config/src/Parsers/Parser.php
Methods #
- parse()
- Parse the config output.
- addChild()
- Recursively adds childs to an array tree.
- checkConfig()
- Check for config issues.
- getValue()
- Interprets a string value and returns it with a PHP type.
- ksortRecursive()
- Sort arrays by keys recursively.
- parseOrThrow()
- -
parse()
public static abstract function parse(mixed $config): array
Parse the config output.
Parameters
- mixed $config
Returns
array
- The parsed configs
addChild()
protected static function addChild(array &$parent, array $childs, mixed $value): void
Recursively adds childs to an array tree.
Parameters
- array $parent - The main array, where the childs will be added
- array $childs - Childs to add
- mixed $value - The last child value
Returns
void
checkConfig()
protected static function checkConfig(mixed $config): void
Check for config issues.
Parameters
- mixed $config - The parser configuration
Returns
void
getValue()
protected static function getValue(string $value): array|string|int|float|bool|null
Interprets a string value and returns it with a PHP type.
Parameters
- string $value - The input value
Returns
array|string|int|float|bool|null
- The output value
ksortRecursive()
protected static function ksortRecursive(mixed $value): mixed
Sort arrays by keys recursively.
Parameters
- mixed $value - The input value
Returns
mixed
- The output value (sorted by keys if the $value is an array)
parseOrThrow()
protected static function parseOrThrow(Closure $function): array
Parameters
- Closure $function
Returns
array