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, mixed $defaultValue, LoggerLevel $level)
Methods
concatanateArrays (line 59)
  • static:
array concatanateArrays (array $l, array $r)
  • array $l
  • array $r
findAndSubst (line 279)

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 111)

Read a global log4php var.

Read a global log4php var. It returns any globally defined log4php.{$key}. Ex:


1 $GLOBALS['log4php.myKey'] = 'myValue';
2 // now you can call
3 $v = LoggerOptionConverter::getSystemProperty('mykey', '');
4

  • 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 331)

Perform variable substitution in string val from the values of keys found in the system propeties.

Perform variable substitution in string val from the values of keys found in the system propeties. The variable substitution delimeters are ${ and }.

For example, if the System properties contains "key=value", then the call


1 $s = LoggerOptionConverter::substituteVars("Value of key is ${key}.");
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 system propeties contains no 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.

Author Avy Sharell</a>

  • static:
string substVars (string $val, [array $props = null])
  • string $val: The string on which variable substitution is performed.
  • array $props
toBoolean (line 137)

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 243)
  • static:
float toFileSize (string $value, float $default)
  • string $value
  • float $default
toInt (line 157)
  • static:
integer toInt (string $value, integer $default)
  • string $value
  • integer $default
toLevel (line 193)

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#classname", 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, mixed $defaultValue, LoggerLevel $level)

Documentation generated on Wed, 10 Sep 2003 22:44:46 +0200 by phpDocumentor 1.2.2