예제 #1
0
 /**
  * @param Logger $log
  * @return mixed
  */
 public function logResults(Logger $log)
 {
     $errors = $this->errorHandler->getErrorLog();
     if (empty($errors)) {
         return;
     }
     $counts = array();
     foreach ($errors as $errorKey => $error) {
         $counts[$errorKey] = $error['count'];
     }
     array_multisort($counts, SORT_NUMERIC, SORT_DESC, $errors);
     $rows = array();
     foreach ($errors as $error) {
         if (!$rows) {
             $rows[] = array_keys($error);
         }
         $rows[] = $this->utils->encode(array_values($error));
     }
     $table = array('Error Log (' . count($errors) . ')', $rows);
     $log->table($table);
 }
예제 #2
0
 /**
  * Register error handler callback
  *
  * @link http://www.php.net/manual/en/function.set-error-handler.php Custom error handler
  * @param  int $errorLevel
  * @return Shopware_Plugins_Core_ErrorHandler_Bootstrap
  */
 public function registerErrorHandler($errorLevel = E_ALL)
 {
     // Only register once.  Avoids loop issues if it gets registered twice.
     if (self::$_registeredErrorHandler) {
         set_error_handler(array($this, 'errorHandler'), $errorLevel);
         return $this;
     }
     self::$_origErrorHandler = set_error_handler(array($this, 'errorHandler'), $errorLevel);
     self::$_registeredErrorHandler = true;
     return $this;
 }