# Class LoggerOptionConverter

A convenience class to convert property values to specific types.

Package: log4php\helpers
Version: $Revision: 1374617 $
Since: 0.5
Located at helpers/LoggerOptionConverter.php

Methods summary
`public static string` | # `getSystemProperty( string $key, string $def )` Read a predefined var. 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. #### Parameters $key `string` $key The key to search for. $def `string` $def The default value to return. #### Returns `string` the string value of the system property, or the default value if there is no property with that key.
`public static` | # `toBooleanEx( mixed $value )` Converts $value to boolean, or throws an exception if not possible. Converts $value to boolean, or throws an exception if not possible.
`public static` | # `toIntegerEx( mixed $value )` Converts $value to integer, or throws an exception if not possible. Floats cannot be converted to integer. Converts $value to integer, or throws an exception if not possible. Floats cannot be converted to integer.
`public static` | # `toPositiveIntegerEx( mixed $value )` Converts $value to integer, or throws an exception if not possible. Floats cannot be converted to integer. Converts $value to integer, or throws an exception if not possible. Floats cannot be converted to integer.
`public static` | # `toLevelEx( mixed $value )` Converts the value to a level. Throws an exception if not possible. Converts the value to a level. Throws an exception if not possible.
`public static integer` | # `toFileSizeEx( mixed $value )` Converts a value to a valid file size (integer). 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 #### Parameters $value `mixed` $value File size (optionally with suffix). #### Returns `integer` Parsed file size.
`public static` | # `toStringEx( mixed $value )` Converts a value to string, or throws an exception if not possible. 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.
`public static string` | # `substConstants( string $string )` Performs value substitution for string options. 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". #### Parameters $string `string` $string String on which to perform substitution. #### Returns `string`