<commit_before><?php

namespace Paraunit\Printer;

use Paraunit\Process\ProcessResultInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Class FinalPrinter.
 */
class FinalPrinter
{
    /**
     * @var OutputContainer[]
     */
    protected $outputContainers;

    /**
     * @var OutputContainer
     */
    protected $fatalErrors;

    /**
     * @var OutputContainer
     */
    protected $errors;

    /**
     * @var OutputContainer
     */
    protected $failures;

    /**
     * @var OutputContainer
     */
    protected $skipped;

    /**
     * @var OutputContainer
     */
    protected $incomplete;

    /**
     * @var OutputContainer
     */
    protected $unknownStatus;

    public function __construct()
    {
        $this->segmentationFaults = new OutputContainer('error', 'SEGMENTATION FAULTS');
        $this->unknownStatus = new OutputContainer('error', 'UNKNOWN STATUS');
        $this->fatalErrors = new OutputContainer('error', 'FATAL ERRORS');
        $this->errors = new OutputContainer('error', 'ERRORS');
        $this->failures = new OutputContainer('fail', 'FAILURES');
        $this->skipped = new OutputContainer('skipped', 'SKIPPED');
        $this->incomplete = new OutputContainer('incomplete', 'INCOMPLETE');

        $this->outputContainers = array(
            $this->segmentationFaults,
            $this->unknownStatus,
            $this->fatalErrors,
            $this->errors,
            $this->failures,
            $this->skipped,
            $this->incomplete,
        );
    }

    /**
     * @param ProcessResultInterface[] $completedProcesses
     * @param \DateInterval            $elapsedTime
     */
    public function printFinalResults(OutputInterface $outputInterface, array $completedProcesses, \DateInterval $elapsedTime)
    {
        $outputInterface->writeln('');
        $outputInterface->writeln('');
        $outputInterface->writeln($elapsedTime->format('Execution time -- %H:%I:%S '));

        $outputInterface->writeln('');
        $outputInterface->writeln('Executed: '.count($completedProcesses).' tests');

        foreach ($completedProcesses as $process) {
            $this->analyzeProcess($process);
        }

        foreach ($this->outputContainers as $outputContainer) {
            $this->printFailuresOutput($outputInterface, $outputContainer);
        }

        foreach ($this->outputContainers as $outputContainer) {
            $this->printFileRecap($outputInterface, $outputContainer);
        }

        $outputInterface->writeln('');
    }

    /**
     * @param ProcessResultInterface $process
     */
    protected function analyzeProcess(ProcessResultInterface $process)
    {
        $filename = $process->getFilename();

        if ($process->hasSegmentationFaults()) {
            $this->segmentationFaults->addFileName($filename);
        }
<commit_msg>Prints executed tests count<commit_after><?php

namespace Paraunit\Printer;

use Paraunit\Process\ProcessResultInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Class FinalPrinter.
 */
class FinalPrinter
{
    /**
     * @var OutputContainer[]
     */
    protected $outputContainers;

    /**
     * @var OutputContainer
     */
    protected $fatalErrors;

    /**
     * @var OutputContainer
     */
    protected $errors;

    /**
     * @var OutputContainer
     */
    protected $failures;

    /**
     * @var OutputContainer
     */
    protected $skipped;

    /**
     * @var OutputContainer
     */
    protected $incomplete;

    /**
     * @var OutputContainer
     */
    protected $unknownStatus;

    public function __construct()
    {
        $this->segmentationFaults = new OutputContainer('error', 'SEGMENTATION FAULTS');
        $this->unknownStatus = new OutputContainer('error', 'UNKNOWN STATUS');
        $this->fatalErrors = new OutputContainer('error', 'FATAL ERRORS');
        $this->errors = new OutputContainer('error', 'ERRORS');
        $this->failures = new OutputContainer('fail', 'FAILURES');
        $this->skipped = new OutputContainer('skipped', 'SKIPPED');
        $this->incomplete = new OutputContainer('incomplete', 'INCOMPLETE');

        $this->outputContainers = array(
            $this->segmentationFaults,
            $this->unknownStatus,
            $this->fatalErrors,
            $this->errors,
            $this->failures,
            $this->skipped,
            $this->incomplete,
        );
    }

    /**
     * @param ProcessResultInterface[] $completedProcesses
     * @param \DateInterval            $elapsedTime
     */
    public function printFinalResults(OutputInterface $outputInterface, array $completedProcesses, \DateInterval $elapsedTime)
    {
        $outputInterface->writeln('');
        $outputInterface->writeln('');
        $outputInterface->writeln($elapsedTime->format('Execution time -- %H:%I:%S '));

        $outputInterface->writeln('');
        $outputInterface->write('Executed: ');
        $outputInterface->write(count($completedProcesses).' test classes, ');

        $testsCount = 0;
        foreach ($completedProcesses as $process) {
            $this->analyzeProcess($process);
            $testsCount += count($process->getTestResults());
        }

        $outputInterface->writeln($testsCount.' tests');

        foreach ($this->outputContainers as $outputContainer) {
            $this->printFailuresOutput($outputInterface, $outputContainer);
        }

        foreach ($this->outputContainers as $outputContainer) {
            $this->printFileRecap($outputInterface, $outputContainer);
        }

        $outputInterface->writeln('');
    }

    /**
     * @param ProcessResultInterface $process
     */
    protected function analyzeProcess(ProcessResultInterface $process)
    {
        $filename = $process->getFilename();

        if ($process->hasSegmentationFaults()) {
            $this->segmentationFaults->addFileName($filename);
        }

{'fraction_non_alphanumeric': 0.13564456411982498, 'fraction_numerical': 0.0001682935038707506, 'mean_word_length': 2.5736620565243538, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7134352', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1569, 'n_words': 280}