<commit_before><?php

namespace DiffMatchPatch;


class Patch
{
    /**
     * @var float When deleting a large block of text (over ~64 characters), how close do
     * the contents have to be to match the expected contents. (0.0 = perfection,
     * 1.0 = very loose).  Note that Match->threshold controls how closely the
     * end points of a delete need to match.
     */
    protected $deleteTreshold = 0.5;
    /**
     * @var int Chunk size for context length.
     */
    protected $margin = 4;
    /**
     * @var Diff
     */
    protected $diff;
    /**
     * @var Match
     */
    protected $match;

    /**
     * @param Diff|null $diff
     * @param Match|null $match
     */
    public function __construct(Diff $diff = null, Match $match = null)
    {
        if (!isset($match)) {
            $match = new Match();
        }
        if (!isset($diff)) {
            $diff = new Diff();
        }

        $this->diff = $diff;
        $this->match = $match;
    }

    /**
     * @return float
     */
    public function getDeleteTreshold()
    {
        return $this->deleteTreshold;
    }

    /**
     * @param float $deleteTreshold
     */
    public function setDeleteTreshold($deleteTreshold)
    {
        $this->deleteTreshold = $deleteTreshold;
    }

    /**
     * @return int
     */
    public function getMargin()
    {
        return $this->margin;
    }

    /**
     * @param int $margin
     */
    public function setMargin($margin)
    {
        $this->margin = $margin;
    }

    /**
     * @return Match
     */
    public function getMatch()
    {
        return $this->match;
    }

    /**
     * @return Diff
     */
    public function getDiff()
    {
        return $this->diff;
    }



    /**
     * Parse a textual representation of patches and return a list of patch objects.
     *
     * @param string $patchText Text representation of patches.
     *
     * @throws \InvalidArgumentException If invalid input.
     * @throws \UnexpectedValueException If text has bad syntax.
     * @return PatchObject[] Array of PatchObjects.
     */
    public function fromText($patchText){
        $patches = array();
        if (!$patchText) {
            return $patches;
        }

        $lines = explode("\n", $patchText);
        while (count($lines)) {
            $line = $lines[0];
            if (!preg_match("/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/", $line, $m)) {
                throw new \InvalidArgumentException("Invalid patch string: " . $line);
            }
            $patch = new PatchObject();
            $patch->setStart1($m[1]);<commit_msg>Fix methods visibility.<commit_after><?php

namespace DiffMatchPatch;


class Patch
{
    /**
     * @var float When deleting a large block of text (over ~64 characters), how close do
     * the contents have to be to match the expected contents. (0.0 = perfection,
     * 1.0 = very loose).  Note that Match->threshold controls how closely the
     * end points of a delete need to match.
     */
    protected $deleteTreshold = 0.5;
    /**
     * @var int Chunk size for context length.
     */
    protected $margin = 4;
    /**
     * @var Diff
     */
    protected $diff;
    /**
     * @var Match
     */
    protected $match;

    /**
     * @param Diff|null $diff
     * @param Match|null $match
     */
    public function __construct(Diff $diff = null, Match $match = null)
    {
        if (!isset($match)) {
            $match = new Match();
        }
        if (!isset($diff)) {
            $diff = new Diff();
        }

        $this->diff = $diff;
        $this->match = $match;
    }

    /**
     * @return float
     */
    public function getDeleteTreshold()
    {
        return $this->deleteTreshold;
    }

    /**
     * @param float $deleteTreshold
     */
    public function setDeleteTreshold($deleteTreshold)
    {
        $this->deleteTreshold = $deleteTreshold;
    }

    /**
     * @return int
     */
    public function getMargin()
    {
        return $this->margin;
    }

    /**
     * @param int $margin
     */
    public function setMargin($margin)
    {
        $this->margin = $margin;
    }

    /**
     * @return Match
     */
    protected function getMatch()
    {
        return $this->match;
    }

    /**
     * @return Diff
     */
    protected function getDiff()
    {
        return $this->diff;
    }



    /**
     * Parse a textual representation of patches and return a list of patch objects.
     *
     * @param string $patchText Text representation of patches.
     *
     * @throws \InvalidArgumentException If invalid input.
     * @throws \UnexpectedValueException If text has bad syntax.
     * @return PatchObject[] Array of PatchObjects.
     */
    public function fromText($patchText){
        $patches = array();
        if (!$patchText) {
            return $patches;
        }

        $lines = explode("\n", $patchText);
        while (count($lines)) {
            $line = $lines[0];
            if (!preg_match("/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/", $line, $m)) {
                throw new \InvalidArgumentException("Invalid patch string: " . $line);
            }
            $patch = new PatchObject();
            $patch->setStart1($m[1]);
{'fraction_non_alphanumeric': 0.13622468475353458, 'fraction_numerical': 0.0045854031333588076, 'mean_word_length': 1.7639915522703273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '6932569', 'n_tokens_mistral': 1551, 'n_tokens_neox': 1500, 'n_words': 425}