Skip to content

final class Config

Source Code

Configuration object

NamespaceBeastBytes\CodPhp
Inheritance

BeastBytes\CodPhp\Config

Methods

__construct()

Create a configuration object, optionally initialising it from a configuration file.

public function __construct(string|null $config = null)
$configstring|nullPath to a file that returns a configuaration array

Declared in BeastBytes\CodPhp\Config


get()

Get the value of a configuration key.

public function get(string $key, mixed|null $default = null): mixed|null
$keystringKey to get.
$defaultmixed|nullA return value if the key does not exist.
returnmixed|null

Declared in BeastBytes\CodPhp\Config


has()

Check if a configuration key exists.

public function has(string $key): bool
$keystringKey to check
returnbool`true` if the key exists, `false` if not

Declared in BeastBytes\CodPhp\Config


merge()

Merge this configuration with another; the other configuration takes precedence.

public function merge(BeastBytes\CodPhp\Config $config): BeastBytes\CodPhp\Config
$configBeastBytes\CodPhp\ConfigThe configuration to merge.
returnBeastBytes\CodPhp\Config

Declared in BeastBytes\CodPhp\Config


set()

Set the value of a configuration key.

public function set(string $key, mixed|null $value): BeastBytes\CodPhp\Config
$keystringKey to set.
$valuemixed|nullValue.
returnBeastBytes\CodPhp\Config

Declared in BeastBytes\CodPhp\Config


Generated by CodPhp