src/Base/Logger/Debugger.php
protected static function getArgumentsFromTrace($row, $explain = false)
    {
        $isClosure = strpos(strtolower($row['function']), '{closure}') !== false;
        $argsSimple = [];
        $argsFull = [];
        $argsStrLength = 0;
        if (!empty($row['args'])) {
            if (!$isClosure) {
                try {
                    $funcRef = isset($row['class']) && $row['class'] !== ""
                        ? new \ReflectionMethod($row['class'], $row['function'])
                        : new \ReflectionFunction($row['function']);
                    $funcParams = $funcRef->getParameters();
                } catch (\ReflectionException $exception) {
                    $funcParams = [];
                }
            } else {
                $funcParams = [];
            }
            foreach ($row['args'] as $argNum => $arg) {
                $argType = $argSimple = gettype($arg);
                $argName = '$...';
                if ($argType === 'object') {
                    $argSimple = get_class($arg);
                }
                if (isset($funcParams[$argNum])) {
                    $argName = '$' . $funcParams[$argNum]->name;
                    $argSimple .= Console::ansiFormat(' ' . $argName, [Console::FG_GREEN]);
                }
                $argSimple = Console::ansiFormat($argSimple, [Console::FG_CYAN]);
                $argsSimple[] = $argSimple;

                if (!$explain) {
                    continue;
                }

                $argIsException = false;
                if ($argType === 'object' && $arg instanceof \Throwable) {
                    $exceptionArgs[] = $argNum;
                    $argIsException = true;
                    $argValue = "'" . $arg->getMessage() . "'" . ' thrown in (' . $arg->getFile() . ' #' . $arg->getLine() . ')';
                } elseif ($argType === 'integer') {
                    $argValue = $arg;
                } elseif ($argType === 'string') {
                    $argValue = strlen($arg) < 80 ? $arg : StringHelper::truncate($arg, 80);
                    $argValue = "'" . $argValue . "'";
                } elseif ($argType === 'boolean') {
                    $argValue = !empty($arg) ? 'TRUE' : 'FALSE';
                } elseif ($argType === 'array') {
                    $argValue = 'array(' . count($arg) . ')';
                } elseif ($arg === null) {
                    $argValue = 'NULL';
                } else {
                    $argValue = $argType === 'object' ? get_class($arg) : $argType;
                }
                $argName = isset($argName) ? $argName : '$';
                $argsStrLength += mb_strlen($argName) + mb_strlen($argValue);
                $argFull = !$argIsException
                    ? Console::ansiFormat($argValue, [Console::FG_CYAN])
                    : Console::ansiFormat($argValue, [Console::FG_RED]);
                $argsFull[$argName] = $argFull;
            }
        }
        return [$argsSimple, $argsFull, $argsStrLength];
    }
protected static function getArgumentsFromTrace($row, $explain = false)
    {
        $isClosure = strpos(strtolower($row['function']), '{closure}') !== false;
        $argsSimple = [];
        $argsFull = [];
        $argsStrLength = 0;
        if (!empty($row['args'])) {
            if (!$isClosure) {
                try {
                    $funcRef = isset($row['class']) && $row['class'] !== ""
                        ? new \ReflectionMethod($row['class'], $row['function'])
                        : new \ReflectionFunction($row['function']);
                    $funcParams = $funcRef->getParameters();
                } catch (\ReflectionException $exception) {
                    $funcParams = [];
                }
            } else {
                $funcParams = [];
            }
            foreach ($row['args'] as $argNum => $arg) {
                $argType = $argSimple = gettype($arg);
                $argName = '$...';
                if ($argType === 'object') {
                    $argSimple = get_class($arg);
                }
                if (isset($funcParams[$argNum])) {
                    $argName = '$' . $funcParams[$argNum]->name;
                    $argSimple .= Console::ansiFormat(' ' . $argName, [Console::FG_GREEN]);
                }
                $argSimple = Console::ansiFormat($argSimple, [Console::FG_CYAN]);
                $argsSimple[] = $argSimple;

                if (!$explain) {
                    continue;
                }

                $argIsException = false;
                if ($argType === 'object' && $arg instanceof \Throwable) {
                    $exceptionArgs[] = $argNum;
                    $argIsException = true;
                    $argValue = "'" . $arg->getMessage() . "'" . ' thrown in (' . $arg->getFile() . ' #' . $arg->getLine() . ')';
                } elseif ($argType === 'integer') {
                    $argValue = $arg;
                } elseif ($argType === 'string') {
                    $argValue = strlen($arg) < 80 ? $arg : StringHelper::truncate($arg, 80);
                    $argValue = "'" . $argValue . "'";
                } elseif ($argType === 'boolean') {
                    $argValue = !empty($arg) ? 'TRUE' : 'FALSE';
                } elseif ($argType === 'array') {
                    $argValue = 'array(' . count($arg) . ')';
                } elseif ($arg === null) {
                    $argValue = 'NULL';
                } else {
                    $argValue = $argType === 'object' ? get_class($arg) : $argType;
                }
                $argName = isset($argName) ? $argName : '$';
                $argsStrLength += mb_strlen($argName) + mb_strlen($argValue);
                $argFull = !$argIsException
                    ? Console::ansiFormat($argValue, [Console::FG_CYAN])
                    : Console::ansiFormat($argValue, [Console::FG_RED]);
                $argsFull[$argName] = $argFull;
            }
        }
        return [$argsSimple, $argsFull, $argsStrLength];
    }
Get trace row arguments
@param array $row
@param bool $explain
@return array