src/Report/CheckstyleReporter.php
public function generate(ReportSummary $reportSummary)
    {
        if (!\extension_loaded('dom')) {
            throw new \RuntimeException('Cannot generate report! `ext-dom` is not available!');
        }

        $dom = new \DOMDocument('1.0', 'UTF-8');
        $checkstyles = $dom->appendChild($dom->createElement('checkstyle'));

        foreach ($reportSummary->getChanged() as $filePath => $fixResult) {
            /** @var \DOMElement $file */
            $file = $checkstyles->appendChild($dom->createElement('file'));
            $file->setAttribute('name', $filePath);

            foreach ($fixResult['appliedFixers'] as $appliedFixer) {
                $error = $this->createError($dom, $appliedFixer);
                $file->appendChild($error);
            }
        }

        $dom->formatOutput = true;

        return $reportSummary->isDecoratedOutput() ? OutputFormatter::escape($dom->saveXML()) : $dom->saveXML();
    }
public function generate(ReportSummary $reportSummary)
    {
        if (!\extension_loaded('dom')) {
            throw new \RuntimeException('Cannot generate report! `ext-dom` is not available!');
        }

        $dom = new \DOMDocument('1.0', 'UTF-8');
        $checkstyles = $dom->appendChild($dom->createElement('checkstyle'));

        foreach ($reportSummary->getChanged() as $filePath => $fixResult) {
            /** @var \DOMElement $file */
            $file = $checkstyles->appendChild($dom->createElement('file'));
            $file->setAttribute('name', $filePath);

            foreach ($fixResult['appliedFixers'] as $appliedFixer) {
                $error = $this->createError($dom, $appliedFixer);
                $file->appendChild($error);
            }
        }

        $dom->formatOutput = true;

        return $reportSummary->isDecoratedOutput() ? OutputFormatter::escape($dom->saveXML()) : $dom->saveXML();
    }
public function generate ( ReportSummary $ reportSummary ) { if ( ! \ extension_loaded ( 'dom' ) ) { throw new \ RuntimeException ( 'Cannot generate report! `ext-dom` is not available!' ) ; } $ dom = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ checkstyles = $ dom -> appendChild ( $ dom -> createElement ( 'checkstyle' ) ) ; foreach ( $ reportSummary -> getChanged ( ) as $ filePath => $ fixResult ) { /** @var \DOMElement $file */ $ file = $ checkstyles -> appendChild ( $ dom -> createElement ( 'file' ) ) ; $ file -> setAttribute ( 'name' , $ filePath ) ; foreach ( $ fixResult [ 'appliedFixers' ] as $ appliedFixer ) { $ error = $ this -> createError ( $ dom , $ appliedFixer ) ; $ file -> appendChild ( $ error ) ; } } $ dom -> formatOutput = true ; return $ reportSummary -> isDecoratedOutput ( ) ? OutputFormatter :: escape ( $ dom -> saveXML ( ) ) : $ dom -> saveXML ( ) ; }
{@inheritdoc}
{