public function dispatch($name, $event)
    {
        if (!$this->event_dispatcher) {
            return null;
        }

        if (!$this->event_dispatcher instanceof Dispatcher) {
            throw new \Exception(
                'Expected the event dispatcher to be an instance of phpDocumentor\Event\Dispatcher'
            );
        }

        $this->event_dispatcher->dispatch($name, $event);
    }