<commit_before><?php namespace Samsui\Generator\Provider;

use Carbon\Carbon;

class Date extends BaseProvider
{
    public function past($duration)
    {
        $lower = strtotime('-' . $duration);
        return Carbon::createFromTimestampUTC($this->generator->math->between($lower, time()));
    }

    public function farFuture($years)
    {
        $upper = strtotime('+' . $years + ' years');
        return Carbon::createFromTimestampUTC($this->generator->math->between(time(), $upper));
    }
}<commit_msg>improved far future date generation, plus argument check<commit_after><?php namespace Samsui\Generator\Provider;

use Carbon\Carbon;

class Date extends BaseProvider
{
    public function past($duration)
    {
        $lower = strtotime('-' . $duration);
        return Carbon::createFromTimestampUTC($this->generator->math->between($lower, time()));
    }

    public function farFuture($years)
    {
        if ($years < 2) {
            throw new \InvalidArgumentException('farFuture() requires $year argument to be at least 2 years or more.');
        }
        $upper = strtotime('+' . ($years + 1) + ' years');
        $lower = strtotime('+' . ($years - 1) + ' years');
        return Carbon::createFromTimestampUTC($this->generator->math->between($lower, $upper));
    }
}
{'fraction_non_alphanumeric': 0.15224111282843894, 'fraction_numerical': 0.0030911901081916537, 'mean_word_length': 3.316666666666667, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 15, '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': '3384641', 'n_tokens_mistral': 375, 'n_tokens_neox': 355, 'n_words': 86}