public function renderReport(Report $report)
    {
        $this->output->writeln('');

        $groupByFile = [];
        /** @var RuleViolation $violation */
        foreach ($report->getRuleViolations() as $violation) {
            $groupByFile[$violation->getFileName()][] = $violation;
        }

        /** @var ProcessingError $error */
        foreach ($report->getErrors() as $error) {
            $groupByFile[$error->getFile()][] = $error;
        }
        foreach ($groupByFile as $file => $problems) {
            $violationCount = 0;
            $errorCount     = 0;

            $table = new Table($this->output);
            $table->setStyle('borderless');
            foreach ($problems as $problem) {
                if ($problem instanceof RuleViolation) {
                    $table->addRow([$problem->getBeginLine(), '<comment>VIOLATION</comment>', $problem->getDescription()]);
                    ++$violationCount;
                }
                if ($problem instanceof ProcessingError) {
                    $table->addRow(['-', '<error>ERROR</error>', $problem->getMessage()]);
                    ++$errorCount;
                }
            }

            $this->output->writeln([
                sprintf('<fg=white;options=bold>FILE: %s</>', str_replace($this->basePath.'/', '', $file)),
                sprintf('<fg=white;options=bold>FOUND %d ERRORS AND %d VIOLATIONS</>', $errorCount, $violationCount),
            ]);
            $table->render();
            $this->output->writeln('');
        }
    }
public function renderReport(Report $report)
    {
        $this->output->writeln('');

        $groupByFile = [];
        /** @var RuleViolation $violation */
        foreach ($report->getRuleViolations() as $violation) {
            $groupByFile[$violation->getFileName()][] = $violation;
        }

        /** @var ProcessingError $error */
        foreach ($report->getErrors() as $error) {
            $groupByFile[$error->getFile()][] = $error;
        }
        foreach ($groupByFile as $file => $problems) {
            $violationCount = 0;
            $errorCount     = 0;

            $table = new Table($this->output);
            $table->setStyle('borderless');
            foreach ($problems as $problem) {
                if ($problem instanceof RuleViolation) {
                    $table->addRow([$problem->getBeginLine(), '<comment>VIOLATION</comment>', $problem->getDescription()]);
                    ++$violationCount;
                }
                if ($problem instanceof ProcessingError) {
                    $table->addRow(['-', '<error>ERROR</error>', $problem->getMessage()]);
                    ++$errorCount;
                }
            }

            $this->output->writeln([
                sprintf('<fg=white;options=bold>FILE: %s</>', str_replace($this->basePath.'/', '', $file)),
                sprintf('<fg=white;options=bold>FOUND %d ERRORS AND %d VIOLATIONS</>', $errorCount, $violationCount),
            ]);
            $table->render();
            $this->output->writeln('');
        }
    }
public function renderReport ( Report $ report ) { $ this -> output -> writeln ( '' ) ; $ groupByFile = [ ] ; /** @var RuleViolation $violation */ foreach ( $ report -> getRuleViolations ( ) as $ violation ) { $ groupByFile [ $ violation -> getFileName ( ) ] [ ] = $ violation ; } /** @var ProcessingError $error */ foreach ( $ report -> getErrors ( ) as $ error ) { $ groupByFile [ $ error -> getFile ( ) ] [ ] = $ error ; } foreach ( $ groupByFile as $ file => $ problems ) { $ violationCount = 0 ; $ errorCount = 0 ; $ table = new Table ( $ this -> output ) ; $ table -> setStyle ( 'borderless' ) ; foreach ( $ problems as $ problem ) { if ( $ problem instanceof RuleViolation ) { $ table -> addRow ( [ $ problem -> getBeginLine ( ) , '<comment>VIOLATION</comment>' , $ problem -> getDescription ( ) ] ) ; ++ $ violationCount ; } if ( $ problem instanceof ProcessingError ) { $ table -> addRow ( [ '-' , '<error>ERROR</error>' , $ problem -> getMessage ( ) ] ) ; ++ $ errorCount ; } } $ this -> output -> writeln ( [ sprintf ( '<fg=white;options=bold>FILE: %s</>' , str_replace ( $ this -> basePath . '/' , '' , $ file ) ) , sprintf ( '<fg=white;options=bold>FOUND %d ERRORS AND %d VIOLATIONS</>' , $ errorCount , $ violationCount ) , ] ) ; $ table -> render ( ) ; $ this -> output -> writeln ( '' ) ; } }
This method will be called when the engine has finished the source analysis
phase.

@param \PHPMD\Report $report
This method will be called when the engine has finished the source analysis phase .