- md5
- 66ed22d1b898bc91c09cee10e5d07e4c
- sha1
- 1337f1caf2dbd12fe89fcf7eedc05191a22e606e
- sha256
- 6f472b2ff142a59e006694fac94daa7b95e66c2a5c968a33f7bdad2d58df9ce0
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
<?php
/**
* @package Joomla.Plugin
* @subpackage System.Debug
*
* @copyright Copyright (C) 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\System\Debug;
use DebugBar\DataFormatter\DataFormatter as DebugBarDataFormatter;
/**
* DataFormatter
*
* @since 4.0.0
*/
class DataFormatter extends DebugBarDataFormatter
{
/**
* Strip the root path.
*
* @param string $path The path.
* @param string $replacement The replacement
*
* @return string
*
* @since 4.0.0
*/
public function formatPath($path, $replacement = ''): string
{
return str_replace(JPATH_ROOT, $replacement, $path);
}
/**
* Format a string from back trace.
*
* @param array $call The array to format
*
* @return string
*
* @since 4.0.0
*/
public function formatCallerInfo(array $call): string
{
$string = '';
if (isset($call['class']))
{
// If entry has Class/Method print it.
$string .= htmlspecialchars($call['class'] . $call['type'] . $call['function']) . '()';
}
elseif (isset($call['args']) && \is_array($call['args'][0]))
{
$string .= htmlspecialchars($call['function']) . ' (';
foreach ($call['args'][0] as $arg)
{
// Check if the arguments can be used as string
if (\is_object($arg) && !method_exists($arg, '__toString'))
{
$arg = \get_class($arg);
}
$string .= htmlspecialchars($arg) . ', ';
}
$string = rtrim($string, ', ') . ')';
}
elseif (isset($call['args']))
{
$string .= htmlspecialchars($call['function']) . ' ' . $call['args'][0];
}
else
{
// It's a function.
$string .= htmlspecialchars($call['function']) . '()';
}
return $string;
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.