private function ExceptionHandler::formatArgs in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/debug/ExceptionHandler.php \Symfony\Component\Debug\ExceptionHandler::formatArgs()
Formats an array as a string.
Parameters
array $args The argument array:
Return value
string
1 call to ExceptionHandler::formatArgs()
- ExceptionHandler::getContent in vendor/
symfony/ debug/ ExceptionHandler.php - Gets the HTML content associated with the given exception.
File
- vendor/
symfony/ debug/ ExceptionHandler.php, line 401
Class
- ExceptionHandler
- ExceptionHandler converts an exception to a Response object.
Namespace
Symfony\Component\DebugCode
private function formatArgs(array $args) {
$result = array();
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
$formattedValue = sprintf('<em>object</em>(%s)', $this
->formatClass($item[1]));
}
elseif ('array' === $item[0]) {
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this
->formatArgs($item[1]) : $item[1]);
}
elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", $this
->escapeHtml($item[1]));
}
elseif ('null' === $item[0]) {
$formattedValue = '<em>null</em>';
}
elseif ('boolean' === $item[0]) {
$formattedValue = '<em>' . strtolower(var_export($item[1], true)) . '</em>';
}
elseif ('resource' === $item[0]) {
$formattedValue = '<em>resource</em>';
}
else {
$formattedValue = str_replace("\n", '', var_export($this
->escapeHtml((string) $item[1]), true));
}
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
}
return implode(', ', $result);
}