3 class Artx_Log_Formatter
8 foreach ($args as $index => $value)
9 $result[] = Artx_Log_Formatter::_formatVar($value);
10 return implode(', ', $result);
13 function _formatVar(&$value)
16 return Artx_Log_Formatter::_formatNull($value);
18 return Artx_Log_Formatter::_formatBool($value);
19 if (is_int($value) || is_float($value))
21 if (is_object($value))
22 return Artx_Log_Formatter::_formatObject($value);
23 // is_callable should be placed before is_string and is_array:
24 if (is_callable($value))
25 return Artx_Log_Formatter::_formatCallback($value);
26 if (is_string($value))
27 return Artx_Log_Formatter::_formatString($value);
29 return Artx_Log_Formatter::_formatArray($value);
30 return gettype($value) . ' { ... }';
33 function _formatNull()
38 function _formatString(&$value)
41 if (strlen($text) > 10)
42 $text = substr($text, 0, 10) . '...';
43 $text = str_replace('\\', '\\\\', $text);
44 $text = str_replace('\'', '\\\'', $text);
45 return '\'' . $text . '\'';
48 function _formatArray(&$value)
50 return 'array(' . count($value) . ') { ... }';
53 function _formatObject(&$value)
55 return get_class($value) . '(...) { ... }';
58 function _formatBool(&$value)
60 return $value ? 'true' : 'false';
63 function _formatCallback(&$value)
65 if (is_string($value))
66 return $value . '(...)';
68 return (is_string($value[0]) ? ($value[0] . '::') : (get_class($value[0]) . '->')) . $value[1];
69 return '#internal error';