<commit_before><?php
namespace ParaTest\Logging\JUnit;

use ParaTest\Logging\MetaProvider;

class Reader extends MetaProvider
{
    /**
     * @var \SimpleXMLElement
     */
    protected $xml;

    /**
     * @var bool
     */
    protected $isSingle = false;

    /**
     * @var array
     */
    protected $suites = array();

    /**
     * @var string
     */
    protected $logFile;

    /**
     * @var array
     */
    protected static $defaultSuite = array('name' => '',
                                           'file' => '',
                                           'tests' => 0,
                                           'assertions' => 0,
                                           'failures' => 0,
                                           'errors' => 0,
                                           'time' => 0);

    public function __construct($logFile)
    {
        if (!file_exists($logFile)) {
            throw new \InvalidArgumentException("Log file $logFile does not exist");
        }

        $this->logFile = $logFile;
        if (filesize($logFile) == 0) {
            throw new \InvalidArgumentException("Log file $logFile is empty. This means a PHPUnit process has crashed.");
        }
        $logFileContents = file_get_contents($this->logFile);
        $this->xml = new \SimpleXMLElement($logFileContents);
        $this->init();
    }

    /**
     * Returns whether or not this reader contains only
     * a single suite
     *
     * @return bool
     */
    public function isSingleSuite()
    {
        return $this->isSingle;
    }

    /**
     * Return the Reader's collection
     * of test suites
     *
     * @return array
     */
    public function getSuites()
    {
        return $this->suites;
    }

    /**
     * Checks whether the xml log has
     * test suite results
     *
     * @return array
     */
    public function hasResults()
    {
        return $this->xml->count() > 0;
    }

    /**
     * Return an array that contains
     * each suite's instant feedback. Since
     * logs do not contain skipped or incomplete
     * tests this array will contain any number of the following
     * characters: .,F,E
     *
     * @return array
     */
    public function getFeedback()
    {
        $feedback = array();
        $suites = $this->isSingle ? $this->suites : $this->suites[0]->suites;
        foreach ($suites as $suite) {
            foreach ($suite->cases as $case) {
                if ($case->failures) {
                    $feedback[] = 'F';
                } elseif ($case->errors) {
                    $feedback[] = 'E';<commit_msg>Removed method, as it is not used anymore.<commit_after><?php
namespace ParaTest\Logging\JUnit;

use ParaTest\Logging\MetaProvider;

class Reader extends MetaProvider
{
    /**
     * @var \SimpleXMLElement
     */
    protected $xml;

    /**
     * @var bool
     */
    protected $isSingle = false;

    /**
     * @var array
     */
    protected $suites = array();

    /**
     * @var string
     */
    protected $logFile;

    /**
     * @var array
     */
    protected static $defaultSuite = array('name' => '',
                                           'file' => '',
                                           'tests' => 0,
                                           'assertions' => 0,
                                           'failures' => 0,
                                           'errors' => 0,
                                           'time' => 0);

    public function __construct($logFile)
    {
        if (!file_exists($logFile)) {
            throw new \InvalidArgumentException("Log file $logFile does not exist");
        }

        $this->logFile = $logFile;
        if (filesize($logFile) == 0) {
            throw new \InvalidArgumentException("Log file $logFile is empty. This means a PHPUnit process has crashed.");
        }
        $logFileContents = file_get_contents($this->logFile);
        $this->xml = new \SimpleXMLElement($logFileContents);
        $this->init();
    }

    /**
     * Returns whether or not this reader contains only
     * a single suite
     *
     * @return bool
     */
    public function isSingleSuite()
    {
        return $this->isSingle;
    }

    /**
     * Return the Reader's collection
     * of test suites
     *
     * @return array
     */
    public function getSuites()
    {
        return $this->suites;
    }

    /**
     * Return an array that contains
     * each suite's instant feedback. Since
     * logs do not contain skipped or incomplete
     * tests this array will contain any number of the following
     * characters: .,F,E
     *
     * @return array
     */
    public function getFeedback()
    {
        $feedback = array();
        $suites = $this->isSingle ? $this->suites : $this->suites[0]->suites;
        foreach ($suites as $suite) {
            foreach ($suite->cases as $case) {
                if ($case->failures) {
                    $feedback[] = 'F';
                } elseif ($case->errors) {
                    $feedback[] = 'E';
{'fraction_non_alphanumeric': 0.11974748471098837, 'fraction_numerical': 0.002959163543105149, 'mean_word_length': 1.4223602484472049, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3937331', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1310, 'n_words': 363}