Esempio n. 1
0
 /**
  * getTraceString
  *
  * @param GenericErrorInterface $error
  * @param int                   $options
  * @param int                   $limit
  *
  * @return mixed|string
  */
 public function getTraceString(GenericErrorInterface $error, $options = 3, $limit = 0)
 {
     $backtrace = $error->getTrace($options);
     $output = '';
     foreach ($backtrace as $i => $call) {
         if ($i > $limit - 1 && $limit !== 0) {
             $output .= '.';
             continue;
         }
         $file = isset($call['file']) ? $this->cleanDirPath($call['file']) : '?';
         $line = isset($call['line']) ? $call['line'] : '?';
         $class = isset($call['class']) ? $call['class'] : '';
         $function = isset($call['function']) ? $call['function'] : '';
         $type = isset($call['type']) ? $call['type'] : '';
         $args = isset($call['args']) ? (array) $call['args'] : [];
         $object = '';
         if (!empty($class)) {
             $object = $class . $type;
         }
         foreach ($args as $key => $arg) {
             if (is_object($arg)) {
                 $args[$key] = get_class($arg);
             } else {
                 if (is_array($arg)) {
                     $args[$key] = 'array';
                 } else {
                     $args[$key] = (string) $arg;
                 }
             }
         }
         $argStr = implode(', ', $args);
         $output .= '# ' . ($i + 1) . ' ' . ': ' . $object . $function . '(' . $argStr . ') ' . "\n" . ' -- File: ' . $file . "\n" . ' -- Line: ' . $line . "\n";
     }
     return $output;
 }
 /**
  * prepareSummary
  *
  * @param GenericErrorInterface $error
  *
  * @return string
  */
 protected function prepareSummary(GenericErrorInterface $error)
 {
     return $error->getType() . ' - ' . $error->getMessage() . ' - ' . $this->buildRelativePath($error->getFile());
 }
Esempio n. 3
0
 /**
  * getTraceString
  *
  * @param GenericErrorInterface $error
  * @param int          $options
  * @param int          $limit
  *
  * @return mixed
  */
 public function getTraceString(GenericErrorInterface $error, $options = 3, $limit = 0)
 {
     $firstError = $error->getFirst();
     $data = $firstError->getTrace();
     return $this->getResponse($data);
 }
Esempio n. 4
0
 /**
  * notify
  *
  * @param string       $event
  * @param GenericErrorInterface $error
  *
  * @return void
  */
 protected function notify($event, GenericErrorInterface $error)
 {
     // Keep us from reporting suppressed errors
     if (!$this->canReportErrors($error->getSeverity())) {
         return;
     }
     // Trigger Event
     $application = $this->event->getApplication();
     $em = $application->getEventManager();
     $em->trigger($event, $this, ['handler' => $this, 'error' => $error, 'config' => $this->config]);
     $em->trigger(self::EVENT_ALL, $this, ['handler' => $this, 'error' => $error, 'config' => $this->config]);
 }
Esempio n. 5
0
 /**
  * getTraceString
  *
  * @param GenericErrorInterface $error
  * @param int                   $options
  * @param int                   $limit
  *
  * @return mixed|string
  */
 public function getTraceString(GenericErrorInterface $error, $options = 3, $limit = 0)
 {
     $backtrace = $error->getTrace($options);
     $ret = [];
     $output = '
         <table dir="ltr"
                border="1"
                cellspacing="0"
                cellpadding="1">
             <tr>
                 <th align="left" bgcolor="#e9b96e" colspan="5">Call Stack</th>
             </tr>
             <tr>
                 <th align="center" bgcolor="#eeeeec">#</th>
                 <th align="left" bgcolor="#eeeeec">Function</th>
                 <th align="left" bgcolor="#eeeeec">Location</th>
             </tr>
     ';
     foreach ($backtrace as $i => $call) {
         if ($i > $limit - 1 && $limit !== 0) {
             $output .= '.';
             continue;
         }
         $file = isset($call['file']) ? $call['file'] : '?';
         $line = isset($call['line']) ? $call['line'] : '?';
         $class = isset($call['class']) ? $call['class'] : '';
         $function = isset($call['function']) ? $call['function'] : '';
         $type = isset($call['type']) ? $call['type'] : '';
         $args = isset($call['args']) ? (array) $call['args'] : [];
         $object = '';
         if (!empty($class)) {
             $object = $class . $type;
         }
         foreach ($args as $key => $arg) {
             if (is_object($arg)) {
                 $args[$key] = get_class($arg);
             } else {
                 if (is_array($arg)) {
                     $args[$key] = 'array';
                 } else {
                     $args[$key] = (string) $arg;
                 }
             }
         }
         $argStr = implode(', ', $args);
         $output .= '
                 <tr>
                     <td bgcolor="#eeeeec" align="center">' . $i . '</td>
                     <td bgcolor="#eeeeec">' . $object . $function . '(' . $argStr . ')' . '
                     </td>
                     <td title="' . $file . '"bgcolor="#eeeeec">' . $file . '<b>:</b>' . $line . '
                     </td>
                 </tr>
             ';
     }
     $output .= '
                 </tbody>
             </table>
         ';
     return $output;
 }