code: protected function backtraceStr(Event $error)
      {
          $backtrace = $error['backtrace']
              ? $error['backtrace'] // backtrace provided
              : $error->getSubject()->backtrace();
          if (\count($backtrace) < 2) {
              return '';
          }
          if ($backtrace && $error['vars']) {
              $backtrace[0]['vars'] = $error['vars'];
          }
          if ($this->cfg['emailBacktraceDumper']) {
              $str = \call_user_func($this->cfg['emailBacktraceDumper'], $backtrace);
          } else {
              $search = array(
                  ")\n\n",
              );
              $replace = array(
                  ")\n",
              );
              $str = \print_r($backtrace, true);
              $str = \preg_replace('#\bArray\n\(#', 'array(', $str);
              $str = \preg_replace('/\barray\s+\(\s+\)/s', 'array()', $str); // single-lineify empty arrays
              $str = \str_replace($search, $replace, $str);
              $str = \substr($str, 0, -1);
          }
          return $str;
      }
docs: Get formatted backtrace string for error
  
  @param Event $error error event
  
  @return string