/**
  * @param Notifier $notifier
  */
 public function registerShutdownHandler(Notifier $notifier)
 {
     $self = $this;
     if (!self::$registerShutdownFlag) {
         register_shutdown_function(function () use($notifier, $self) {
             if (false != ($lastError = $self->catchLastError())) {
                 $notifier->reportPhpError($lastError['type'], $lastError['message'], $lastError['file'], $lastError['line']);
             }
             $notifier->flush();
         });
         self::$registerShutdownFlag = true;
     }
 }