Class LoggerOptionConverter

Description

A convenience class to convert property values to specific types.

A convenience class to convert property values to specific types.

Located in Program_Root/log4php/helpers/LoggerOptionConverter.php (line 42)


	
			
Method Summary
array concatanateArrays (array $l, array $r)
string findAndSubst (string $key, array $props)
string getSystemProperty (string $key, string $def)
void OptionConverter ()
string substVars (string $val, [array $props = null])
boolean toBoolean (string $value, boolean $default)
float toFileSize (string $value, float $default)
integer toInt (string $value, integer $default)
LoggerLevel toLevel (string $value, LoggerLevel $defaultValue)
Methods
concatanateArrays (line 59)
  • static:
array concatanateArrays (array $l, array $r)
  • array $l
  • array $r
findAndSubst (line 278)

Find the value corresponding to $key in $props. found value.

Find the value corresponding to $key in $props. Then perform variable substitution on the found value.

  • static:
string findAndSubst (string $key, array $props)
  • string $key
  • array $props
getSystemProperty (line 107)

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.

  • return: the string value of the system property, or the default value if there is no property with that key.
  • static:
string getSystemProperty (string $key, string $def)
  • string $key: The key to search for.
  • string $def: The default value to return.
OptionConverter (line 47)

OptionConverter is a static class.

OptionConverter is a static class.

void OptionConverter ()
substVars (line 322)

Perform variable substitution in string $val from the values of keys found with the getSystemProperty() method.

Perform variable substitution in string $val from the values of keys found with the getSystemProperty() method. The variable substitution delimeters are ${ and }.

For example, if the "MY_CONSTANT" contains "value", then the call


1 $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
will set the variable $s to "Value of key is value.".

If no value could be found for the specified key, then the $props parameter is searched, if the value could not be found there, then substitution defaults to the empty string.

For example, if getSystemProperty() cannot find any value for the key "inexistentKey", then the call


1 $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
will set $s to "Value of inexistentKey is []".

A warn is thrown if $val contains a start delimeter "${" which is not balanced by a stop delimeter "}" and an empty string is returned.

  • static:
  • log4j-author: Avy Sharell
string substVars (string $val, [array $props = null])
  • string $val: The string on which variable substitution is performed.
  • array $props
toBoolean (line 134)

If $value is true, then true is returned. true is returned. returned.

If $value is true, then true is returned. If $value is false, then true is returned. Otherwise, $default is returned. Case of value is unimportant.

  • static:
boolean toBoolean (string $value, boolean $default)
  • string $value
  • boolean $default
toFileSize (line 242)
  • static:
float toFileSize (string $value, float $default)
  • string $value
  • float $default
toInt (line 154)
  • static:
integer toInt (string $value, integer $default)
  • string $value
  • integer $default
toLevel (line 191)

Converts a standard or custom priority level to a Level object.

Converts a standard or custom priority level to a Level object. If $value is of form "level#full_file_classname", where full_file_classname means the class filename with path but without php extension, then the specified class' toLevel() method is called to process the specified level string; if no '#' character is present, then the default LoggerLevel class is used to process the level value.

As a special case, if the $value parameter is equal to the string "NULL", then the value null will be returned.

If any error occurs while converting the value to a level, the $defaultValue parameter, which may be null, is returned.

Case of $value is insignificant for the level level, but is significant for the class name part, if present.

LoggerLevel toLevel (string $value, LoggerLevel $defaultValue)

Documentation generated on Tue, 28 Oct 2003 22:04:09 +0100 by phpDocumentor 1.2.2