Magento Debug methods
Definition at line 11 of file Debug.php.
◆ _formatCalledArgument()
static _formatCalledArgument |
( |
|
$arg | ) |
|
|
staticprotected |
Format argument in called method
- Parameters
-
- Returns
- string @SuppressWarnings(PHPMD.CyclomaticComplexity)
Definition at line 148 of file Debug.php.
151 if (is_object($arg)) {
152 $out .= sprintf(
"&%s#%s#", get_class($arg), spl_object_hash($arg));
155 }
elseif (is_array($arg)) {
156 $isAssociative =
false;
158 foreach ($arg as $k => $v) {
159 if (!is_numeric($k)) {
160 $isAssociative =
true;
164 if ($isAssociative) {
166 foreach ($args as $k => $v) {
169 $out .=
'array(' . join(
', ', $arr) .
')';
171 $out .=
'array(' . join(
', ', $args) .
')';
173 }
elseif ($arg ===
null) {
175 }
elseif (is_numeric($arg) || is_float($arg)) {
177 }
elseif (is_string($arg)) {
178 if (strlen($arg) > self::$argLength) {
179 $arg = substr($arg, 0, self::$argLength) .
"...";
181 $arg = strtr($arg, [
"\t" =>
'\t',
"\r" =>
'\r',
"\n" =>
'\n',
"'" =>
'\\\'']);
182 $out .=
"'" . $arg .
"'";
183 }
elseif (is_bool($arg)) {
184 $out .= $arg ===
true ?
'true' :
'false';
elseif(isset( $params[ 'redirect_parent']))
static _formatCalledArgument($arg)
◆ backtrace()
static backtrace |
( |
|
$return = false , |
|
|
|
$html = true , |
|
|
|
$withArgs = true |
|
) |
| |
|
static |
Prints or returns a backtrace
- Parameters
-
bool | $return | return or print |
bool | $html | output in HTML format |
bool | $withArgs | add short arguments of methods |
- Returns
- string|bool
Definition at line 50 of file Debug.php.
52 $trace = debug_backtrace();
53 return self::trace($trace, $return, $html, $withArgs);
static trace(array $trace, $return=false, $html=true, $withArgs=true)
◆ getRootPath()
Retrieve real root path with last directory separator
- Returns
- string
Definition at line 30 of file Debug.php.
32 if (self::$_filePath ===
null) {
34 self::$_filePath =
BP;
36 self::$_filePath = dirname(
__DIR__);
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ trace()
static trace |
( |
array |
$trace, |
|
|
|
$return = false , |
|
|
|
$html = true , |
|
|
|
$withArgs = true |
|
) |
| |
|
static |
Prints or return a trace
- Parameters
-
array | $trace | trace array |
bool | $return | return or print |
bool | $html | output in HTML format |
bool | $withArgs | add short arguments of methods |
- Returns
- string|bool @SuppressWarnings(PHPMD.CyclomaticComplexity) @SuppressWarnings(PHPMD.NPathComplexity)
Definition at line 67 of file Debug.php.
74 foreach ($trace as
$i =>
$data) {
82 if (isset(
$data[
'args']) && $withArgs) {
83 foreach (
$data[
'args'] as $arg) {
89 if (isset(
$data[
'class']) && isset(
$data[
'function'])) {
90 if (isset(
$data[
'object']) && get_class(
$data[
'object']) !=
$data[
'class']) {
95 if (isset(
$data[
'object'])) {
99 $methodName = sprintf(
107 $methodName = sprintf(
'%s(%s)',
$data[
'function'], join(
', ', $args));
110 if (isset(
$data[
'file'])) {
111 $pos = strpos(
$data[
'file'], self::getRootPath());
112 if (
$pos !==
false) {
113 $data[
'file'] = substr(
$data[
'file'], strlen(self::getRootPath()) + 1);
121 $out .= sprintf(
'#%d %s called at [%s]',
$i, $methodName,
$fileName);
123 $out .= sprintf(
'#%d %s',
$i, $methodName);
elseif(isset( $params[ 'redirect_parent']))
static _formatCalledArgument($arg)
◆ $_filePath
◆ $argLength
The documentation for this class was generated from the following file: