[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/log4php.debug/helpers/ -> LoggerOptionConverter.php (summary)

log4php is a PHP port of the log4j java logging package. <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p> <p>Design, strategies and part of the methods documentation are developed by log4j team (Ceki G�lc� as log4j project founder and {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>

File Size: 350 lines (12 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

LoggerOptionConverter:: (9 methods):
  OptionConverter()
  concatanateArrays()
  getSystemProperty()
  toBoolean()
  toInt()
  toLevel()
  toFileSize()
  findAndSubst()
  substVars()


Class: LoggerOptionConverter  - X-Ref

A convenience class to convert property values to specific types.

OptionConverter()   X-Ref
OptionConverter is a static class.


concatanateArrays($l, $r)   X-Ref

param: array $l
param: array $r
return: array

getSystemProperty($key, $def)   X-Ref
Read a predefined var.

It returns a value referenced by <var>$key</var> using this search criteria:
- if <var>$key</var> is a constant then return it. Else
- if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
- return <var>$def</var>.

param: string $key The key to search for.
param: string $def The default value to return.
return: string    the string value of the system property, or the default

toBoolean($value, $default)   X-Ref
If <var>$value</var> is <i>true</i>, then <i>true</i> is
returned. If <var>$value</var> is <i>false</i>, then
<i>true</i> is returned. Otherwise, <var>$default</var> is
returned.

<p>Case of value is unimportant.</p>

param: string $value
param: boolean $default
return: boolean

toInt($value, $default)   X-Ref

param: string $value
param: integer $default
return: integer

toLevel($value, $defaultValue)   X-Ref
Converts a standard or custom priority level to a Level
object.

<p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
where <i>full_file_classname</i> means the class filename with path
but without php extension, then the specified class' <i>toLevel()</i> method
is called to process the specified level string; if no '#'
character is present, then the default {@link LoggerLevel}
class is used to process the level value.</p>

<p>As a special case, if the <var>$value</var> parameter is
equal to the string "NULL", then the value <i>null</i> will
be returned.</p>

<p>If any error occurs while converting the value to a level,
the <var>$defaultValue</var> parameter, which may be
<i>null</i>, is returned.</p>

<p>Case of <var>$value</var> is insignificant for the level level, but is
significant for the class name part, if present.</p>

param: string $value
param: LoggerLevel $defaultValue
return: LoggerLevel a {@link LoggerLevel} or null

toFileSize($value, $default)   X-Ref

param: string $value
param: float $default
return: float

findAndSubst($key, $props)   X-Ref
Find the value corresponding to <var>$key</var> in
<var>$props</var>. Then perform variable substitution on the
found value.

param: string $key
param: array $props
return: string

substVars($val, $props = null)   X-Ref
Perform variable substitution in string <var>$val</var> from the
values of keys found with the {@link getSystemProperty()} method.

<p>The variable substitution delimeters are <b>${</b> and <b>}</b>.

<p>For example, if the "MY_CONSTANT" contains "value", then
the call
<code>
$s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
</code>
will set the variable <i>$s</i> to "Value of key is value.".</p>

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

<p>For example, if {@link getSystemProperty()} cannot find any value for the key
"inexistentKey", then the call
<code>
$s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
</code>
will set <var>$s</var> to "Value of inexistentKey is []".</p>

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

param: string $val The string on which variable substitution is performed.
param: array $props
return: string



Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1