{eac}Doojigger Reference

WPConfigTransformer
in package

Transforms a wp-config.php file.

Table of Contents

ANCHOR_EOF  = 'EOF'
Append to end of file
__construct()  : mixed
Instantiates the class with a valid wp-config.php.
add()  : bool
Adds a config to the wp-config.php file.
exists()  : bool
Checks if a config exists in the wp-config.php file.
get_value()  : string|null
Get the value of a config in the wp-config.php file.
remove()  : bool
Removes a config from the wp-config.php file.
update()  : bool
Updates an existing config in the wp-config.php file.

Constants

Methods

__construct()

Instantiates the class with a valid wp-config.php.

public __construct(string $wp_config_path) : mixed
Parameters
$wp_config_path : string

Path to a wp-config.php file.

Tags
throws
Exception

If the wp-config.php file is missing.

throws
Exception

If the wp-config.php file is not writable.

Return values
mixed

add()

Adds a config to the wp-config.php file.

public add(string $type, string $name, string $value[, array<string|int, mixed> $options = array() ]) : bool
Parameters
$type : string

Config type (constant or variable).

$name : string

Config name.

$value : string

Config value.

$options : array<string|int, mixed> = array()

(optional) Array of special behavior options.

Tags
throws
Exception

If the config value provided is not a string.

throws
Exception

If the config placement anchor could not be located.

Return values
bool

exists()

Checks if a config exists in the wp-config.php file.

public exists(string $type, string $name) : bool
Parameters
$type : string

Config type (constant or variable).

$name : string

Config name.

Tags
throws
Exception

If the wp-config.php file is empty.

throws
Exception

If the requested config type is invalid.

Return values
bool

get_value()

Get the value of a config in the wp-config.php file.

public get_value(string $type, string $name) : string|null
Parameters
$type : string

Config type (constant or variable).

$name : string

Config name.

Tags
throws
Exception

If the wp-config.php file is empty.

throws
Exception

If the requested config type is invalid.

Return values
string|null

remove()

Removes a config from the wp-config.php file.

public remove(string $type, string $name) : bool
Parameters
$type : string

Config type (constant or variable).

$name : string

Config name.

Return values
bool

update()

Updates an existing config in the wp-config.php file.

public update(string $type, string $name, string $value[, array<string|int, mixed> $options = array() ]) : bool
Parameters
$type : string

Config type (constant or variable).

$name : string

Config name.

$value : string

Config value.

$options : array<string|int, mixed> = array()

(optional) Array of special behavior options.

Tags
throws
Exception

If the config value provided is not a string.

Return values
bool

Search results