## Class LoggerOptionConverter

Description

A convenience class to convert property values to specific types.

- version: $Revision: 1374617 $
- since: 0.5

Located in /log4php/helpers/LoggerOptionConverter.php (line 29)

Method Summary
static string getSystemProperty (string $key, string $def)
static string substConstants (string $string)
static void toBooleanEx ( $value)
static integer toFileSizeEx (mixed $value)
static void toIntegerEx ( $value)
static void toLevelEx ( $value)
static void toPositiveIntegerEx ( $value)
static void toStringEx ( $value)
Methods
static method getSystemProperty (line 56)

Read a predefined var.

It returns a value referenced by $key using this search criteria:

- if $key is a constant then return it. Else
- if $key is set in $_ENV then return it. Else
- return $def.

- return: the string value of the system property, or the default value if there is no property with that key.
- access: public

static string getSystemProperty (string $key, string $def)

- string $key: The key to search for.
- string $def: The default value to return.

static method substConstants (line 215)

Performs value substitution for string options.

An option can contain PHP constants delimited by '${' and '}'.

E.g. for input string "some ${FOO} value", the method will attempt to substitute ${FOO} with the value of constant FOO if it exists.

Therefore, if FOO is a constant, and it has value "bar", the resulting string will be "some bar value".

If the constant is not defined, it will be replaced by an empty string, and the resulting string will be "some value".

- access: public

static string substConstants (string $string)

- string $string: String on which to perform substitution.

static method toBooleanEx (line 69)

Converts $value to boolean, or throws an exception if not possible.

- access: public

static void toBooleanEx ( $value)

- $value

static method toFileSizeEx (line 144)

Converts a value to a valid file size (integer).

Supports 'KB', 'MB' and 'GB' suffixes, where KB = 1024 B etc.

The final value will be rounded to the nearest integer.

Examples:

- '100' => 100
- '100.12' => 100
- '100KB' => 102400
- '1.5MB' => 1572864

- return: Parsed file size.
- access: public

static integer toFileSizeEx (mixed $value)

- mixed $value: File size (optionally with suffix).

static method toIntegerEx (line 90)

Converts $value to integer, or throws an exception if not possible.

Floats cannot be converted to integer.

- access: public

static void toIntegerEx ( $value)

- $value

static method toLevelEx (line 117)

Converts the value to a level. Throws an exception if not possible.

- access: public

static void toLevelEx ( $value)

- $value

static method toPositiveIntegerEx (line 105)

Converts $value to integer, or throws an exception if not possible.

Floats cannot be converted to integer.

- access: public

static void toPositiveIntegerEx ( $value)

- $value

static method toStringEx (line 184)

Converts a value to string, or throws an exception if not possible.

Objects can be converted to string if they implement the magic __toString() method.

- access: public

static void toStringEx ( $value)

- $value

Documentation generated on Mon, 02 Feb 2026 13:59:51 +0900 by phpDocumentor 1.4.4