public function run() { while (list($defer, $data) = array_shift($this->defers)) { try { $defer(self::$id++, $data); } catch (\Exception $e) { if ($handler = $this->handler) { $handler($e); } else { throw $e; } } } }