Aplus Framework Docs

DatabaseParser extends Parser
in package

Class DatabaseParser.

Table of Contents

parse()  : array<string|int, mixed>
Get config from a database.
addChild()  : void
Recursively adds childs to an array tree.
checkConfig()  : void
Check for config issues.
getValue()  : array<int|string, mixed>|bool|float|int|string|null
Interprets a string value and returns it with a PHP type.
ksortRecursive()  : mixed
Sort arrays by keys recursively.
parseOrThrow()  : array<int|string, mixed>

Methods

parse()

Get config from a database.

public static parse(mixed $config) : array<string|int, mixed>
Parameters
$config : mixed

array with configs for database connection: host, port, username, password, schema and table

Tags
throws
ParserException
Return values
array<string|int, mixed>

The database parsed data

addChild()

Recursively adds childs to an array tree.

protected static addChild(array<int|string, mixed> &$parent, array<int|string, mixed> $childs, mixed $value) : void
Parameters
$parent : array<int|string, mixed>

The main array, where the childs will be added

$childs : array<int|string, mixed>

Childs to add

$value : mixed

The last child value

Return values
void

checkConfig()

Check for config issues.

protected static checkConfig(mixed $config) : void
Parameters
$config : mixed

The parser configuration

Return values
void

getValue()

Interprets a string value and returns it with a PHP type.

protected static getValue(string $value) : array<int|string, mixed>|bool|float|int|string|null
Parameters
$value : string

The input value

Return values
array<int|string, mixed>|bool|float|int|string|null

The output value

ksortRecursive()

Sort arrays by keys recursively.

protected static ksortRecursive(mixed $value) : mixed
Parameters
$value : mixed

The input value

Return values
mixed

The output value (sorted by keys if the $value is an array)

parseOrThrow()

protected static parseOrThrow(Closure $function) : array<int|string, mixed>
Parameters
$function : Closure
Tags
throws
ParserException

If config data can not be parsed

Return values
array<int|string, mixed>

Search results