private function debugQuery(QueryDebugger $queryDebugger = null)
    {
        if ($queryDebugger === null) {
            return;
        }

        $queryDebugger->stop();

        $this->getConfiguration()->getEventDispatcher()->dispatch(
            Events::QUERY_DEBUG,
            new QueryDebugEvent($queryDebugger)
        );
    }