public function getRenderer()
    {
        if (!class_exists('\\PHPMD\\Writer\\StreamWriter')) {
            $renderClass = 'PHP_PMD_RENDERER_' . $this->className;
            $writerClass = 'PHP_PMD_Writer_Stream';
            include_once 'PHP/PMD/Renderer/' . $this->className . '.php';
            include_once 'PHP/PMD/Writer/Stream.php';
        } else {
            $renderClass = 'PHPMD\Renderer\\' . $this->className;
            $writerClass = '\PHPMD\Writer\StreamWriter';
        }

        $renderer = new $renderClass();

        // Create a report stream
        if ($this->getUseFile() === false || $this->getOutfile() === null) {
            $stream = STDOUT;
        } else {
            $stream = fopen($this->getOutfile()->getAbsoluteFile(), 'wb');
        }

        $renderer->setWriter(new $writerClass($stream));

        return $renderer;
    }