<commit_before><?php

namespace OFFLINE\Bootstrapper\October\Util;


use Symfony\Component\Process\Process;

/**
 * Class Composer
 * @package OFFLINE\Bootstrapper\October\Util
 */
class Composer
{

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

    /**
     * Run Composer commands.
     */
    public function __construct()
    {
        $this->composer = $this->findComposer();
    }

    /**
     * Get the composer command for the environment.
     *
     * @return string
     */
    protected function findComposer()
    {
        if (file_exists(getcwd() . '/composer.phar')) {
            return '"' . PHP_BINARY . '" composer.phar';
        }

        return 'composer';
    }

    /**
     * Composer install
     *
     * @return void
     * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
     * @throws \Symfony\Component\Process\Exception\RuntimeException
     * @throws \Symfony\Component\Process\Exception\LogicException
     */
    public function install()
    {
        (new Process($this->composer . ' install --no-scripts --no-interaction'))
            ->setTimeout(3600)
            ->run();
    }

    /**
     * Composer require
     *
     * @return void
     * @throws \Symfony\Component\Process\Exception\LogicException
     * @throws \Symfony\Component\Process\Exception\RuntimeException
     * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
     */
    public function addDependency($package)
    {
        $package = escapeshellarg($package);

        (new Process($this->composer . ' require ' . $package . ' --no-interaction'))
            ->setTimeout(3600)
            ->run();
    }
}<commit_msg>Added --prefer-dist to composer install<commit_after><?php

namespace OFFLINE\Bootstrapper\October\Util;


use Symfony\Component\Process\Process;

/**
 * Class Composer
 * @package OFFLINE\Bootstrapper\October\Util
 */
class Composer
{

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

    /**
     * Run Composer commands.
     */
    public function __construct()
    {
        $this->composer = $this->findComposer();
    }

    /**
     * Get the composer command for the environment.
     *
     * @return string
     */
    protected function findComposer()
    {
        if (file_exists(getcwd() . '/composer.phar')) {
            return '"' . PHP_BINARY . '" composer.phar';
        }

        return 'composer';
    }

    /**
     * Composer install
     *
     * @return void
     * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
     * @throws \Symfony\Component\Process\Exception\RuntimeException
     * @throws \Symfony\Component\Process\Exception\LogicException
     */
    public function install()
    {
        (new Process($this->composer . ' install --no-scripts --no-interaction --prefer-dist'))
            ->setTimeout(3600)
            ->run();
    }

    /**
     * Composer require
     *
     * @return void
     * @throws \Symfony\Component\Process\Exception\LogicException
     * @throws \Symfony\Component\Process\Exception\RuntimeException
     * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
     */
    public function addDependency($package)
    {
        $package = escapeshellarg($package);

        (new Process($this->composer . ' require ' . $package . ' --no-interaction'))
            ->setTimeout(3600)
            ->run();
    }
}
{'fraction_non_alphanumeric': 0.13200934579439252, 'fraction_numerical': 0.004672897196261682, 'mean_word_length': 2.1712962962962963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '474365', 'n_tokens_mistral': 1000, 'n_tokens_neox': 966, 'n_words': 175}