<commit_before><?php

/**
 * PHP Version 5.3
 *
 * @copyright   (c) 2015 <NAME>
 * @author      <NAME> <<EMAIL>>
 * @license     http://opensource.org/licenses/MIT MIT
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ptlis\CoverageMonitor\Coverage;

/**
 * Adapter wrapping PHPUnit's \PHP_CodeCoverage_Report_Node_File class & exposing a more convenient interface for
 *  the purpose of this library.
 */
class CoverageFile
{
    private $file;

    private $workingDirectory;


    public function __construct(\PHP_CodeCoverage_Report_Node_File $file, $workingDirectory)
    {
        $this->file = $file;
        $this->workingDirectory = realpath($workingDirectory);

        // validation
        $containingDirectory = substr($this->file->getPath(), 0, strlen($this->workingDirectory));
        if ($containingDirectory !== $this->workingDirectory) {
            throw new \RuntimeException('Incorrect working directory provided.');
        }
    }

    public function getName()
    {
        return $this->file->getName();
    }

    /**
     * Get the relative path to the file.
     *
     * @return string<commit_msg>Add: Omitted docblocks for CoverageFile.<commit_after><?php

/**
 * PHP Version 5.3
 *
 * @copyright   (c) 2015 <NAME>
 * @author      <NAME> <<EMAIL>>
 * @license     http://opensource.org/licenses/MIT MIT
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ptlis\CoverageMonitor\Coverage;

/**
 * Adapter wrapping PHPUnit's \PHP_CodeCoverage_Report_Node_File class & exposing a more convenient interface for
 *  the purpose of this library.
 */
class CoverageFile
{
    /**
     * @var \PHP_CodeCoverage_Report_Node_File  PHPUnit coverage object.
     */
    private $file;

    /**
     * @var string  The working directory during test execution.
     */
    private $workingDirectory;


    /**
     * Constructor.
     *
     * @param \PHP_CodeCoverage_Report_Node_File $file
     * @param string $workingDirectory
     */
    public function __construct(\PHP_CodeCoverage_Report_Node_File $file, $workingDirectory)
    {
        $this->file = $file;
        $this->workingDirectory = realpath($workingDirectory);

        // validation
        $containingDirectory = substr($this->file->getPath(), 0, strlen($this->workingDirectory));
        if ($containingDirectory !== $this->workingDirectory) {
            throw new \RuntimeException('Incorrect working directory provided.');
        }
    }

    /**
     * The filename.
     *
     * @return string
     */
    public function getName()
    {
        return $this->file->getName();
    }

    /**
     * Get the relative path to the file.
     *
     * @return string
{'fraction_non_alphanumeric': 0.11384399156711174, 'fraction_numerical': 0.004919184820801124, 'mean_word_length': 2.765873015873016, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, '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': '98200', 'n_tokens_mistral': 819, 'n_tokens_neox': 778, 'n_words': 215}