<commit_before><?php

/*
 * This file is part of the Yodler package.
 *
 * (c) aes3xs <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Aes3xs\Yodler\Service;

/**
 * Helper service to interact with git repositories.
 */
class Git
{
    /**
     * @var Shell
     */
    protected $shell;

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

    /**
     * @var bool
     */
    protected $isReferenceSupported;

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

    /**
     * Constructor.
     *
     * @param Shell $shell
     */
    public function __construct(Shell $shell)
    {
        $this->shell = $shell;
    }

    /**
     * @param $keyPath
     */
    public function setKey($keyPath)
    {
        $this->key = $keyPath;
    }

    /**
     * @param $path
     * @param $revision
     */
    public function checkout($path, $revision)
    {
        $git = $this->getGitPath();
        $this->shell->exec("cd $path && $git checkout $revision");
    }

    /**
     * @param $repository
     * @param $target<commit_msg>Rename method<commit_after><?php

/*
 * This file is part of the Yodler package.
 *
 * (c) aes3xs <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Aes3xs\Yodler\Service;

/**
 * Helper service to interact with git repositories.
 */
class Git
{
    /**
     * @var Shell
     */
    protected $shell;

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

    /**
     * @var bool
     */
    protected $isReferenceSupported;

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

    /**
     * Constructor.
     *
     * @param Shell $shell
     */
    public function __construct(Shell $shell)
    {
        $this->shell = $shell;
    }

    /**
     * @param $keyPath
     */
    public function setKeyPath($keyPath)
    {
        $this->key = $keyPath;
    }

    /**
     * @param $path
     * @param $revision
     */
    public function checkout($path, $revision)
    {
        $git = $this->getGitPath();
        $this->shell->exec("cd $path && $git checkout $revision");
    }

    /**
     * @param $repository
     * @param $target
{'fraction_non_alphanumeric': 0.14038128249566725, 'fraction_numerical': 0.0017331022530329288, 'mean_word_length': 1.8647642679900744, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '1958539', 'n_tokens_mistral': 744, 'n_tokens_neox': 721, 'n_words': 188}