abstract class ConfigHelper

Methods

static array
filterConfig(array $config, string $target = 'PHP')

Recursively filter a config array to replace variants with the desired value

static mixed
generateQuickMatchFromList(array $strings)

Generate a quickMatch string from a list of strings

static array
optimizeArray(array $config, array $cache = [])

Optimize the size of a deep array by deduplicating identical structures

static array
toArray(mixed $value, bool $keepEmpty = false, bool $keepNull = false)

Convert a structure to a (possibly multidimensional) array

Details

at line 25
static array filterConfig(array $config, string $target = 'PHP')

Recursively filter a config array to replace variants with the desired value

Parameters

array $config

Config array

string $target

Target parser

Return Value

array

Filtered config

at line 56
static mixed generateQuickMatchFromList(array $strings)

Generate a quickMatch string from a list of strings

This is basically a LCS implementation, tuned for small strings and fast failure

Parameters

array $strings

Array of strings

Return Value

mixed

quickMatch string, or FALSE if none could be generated

at line 107
static array optimizeArray(array $config, array $cache = [])

Optimize the size of a deep array by deduplicating identical structures

This method is meant to be used on a config array which is only read and never modified

Parameters

array $config
array $cache

Return Value

array

at line 141
static array toArray(mixed $value, bool $keepEmpty = false, bool $keepNull = false)

Convert a structure to a (possibly multidimensional) array

Parameters

mixed $value
bool $keepEmpty

Whether to keep empty arrays instead of removing them

bool $keepNull

Whether to keep NULL values instead of removing them

Return Value

array