PMA\libraries\Error::getFunctionCall PHP Method

getFunctionCall() public static method

Formats function call in a backtrace
public static getFunctionCall ( array $step, string $separator ) : string
$step array backtrace step
$separator string Arguments separator to use
return string
    public static function getFunctionCall($step, $separator)
    {
        $retval = $step['function'] . '(';
        if (isset($step['args'])) {
            if (count($step['args']) > 1) {
                $retval .= $separator;
                foreach ($step['args'] as $arg) {
                    $retval .= "\t";
                    $retval .= $arg;
                    $retval .= ',' . $separator;
                }
            } elseif (count($step['args']) > 0) {
                foreach ($step['args'] as $arg) {
                    $retval .= $arg;
                }
            }
        }
        $retval .= ')';
        return $retval;
    }

Usage Example

 /**
  * return formatted backtrace field
  *
  * @param array  $backtrace Backtrace data
  * @param string $separator Arguments separator to use
  * @param string $lines     Lines separator to use
  *
  * @return string formatted backtrace
  */
 public static function formatBacktrace($backtrace, $separator, $lines)
 {
     $retval = '';
     foreach ($backtrace as $step) {
         if (isset($step['file']) && isset($step['line'])) {
             $retval .= Error::relPath($step['file']) . '#' . $step['line'] . ': ';
         }
         if (isset($step['class'])) {
             $retval .= $step['class'] . $step['type'];
         }
         $retval .= Error::getFunctionCall($step, $separator);
         $retval .= $lines;
     }
     return $retval;
 }