<commit_before><?php

namespace App\Social;

use Carbon\Carbon;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;

class GithubUser implements Arrayable
{
    /**
     * @var array
     */
    private $attributes;

    public function __construct(array $attributes)
    {
        $this->attributes = $attributes;
    }

    public function isYoungerThanTwoWeeks(): bool
    {
        return $this->createdAt() > $this->twoWeeksAgo();
    }

    public function createdAt(): Carbon
    {
        return new Carbon($this->get('created_at'));
    }

    private function twoWeeksAgo(): Carbon
    {
        return Carbon::now()->subDays(14);
    }

    private function get($name)
    {
        return Arr::get($this->attributes, $name);
    }

    public function toArray(): array
    {
        return [
            'id' => $this->attributes['id'],
            'name' => $this->attributes['name'],
            'email' => $this->attributes['email'],
            'username' => $this->attributes['login'],
        ];
    }
}<commit_msg>Improve GithubUser<commit_after><?php

namespace App\Social;

use Carbon\Carbon;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;

class GithubUser implements Arrayable
{
    /**
     * @var array
     */
    private $attributes;

    public function __construct(array $attributes)
    {
        $this->attributes = $attributes;
    }

    public function isYoungerThanTwoWeeks(): bool
    {
        return $this->createdAt() > $this->twoWeeksAgo();
    }

    public function createdAt(): Carbon
    {
        return new Carbon($this->get('created_at'));
    }

    private function twoWeeksAgo(): Carbon
    {
        return Carbon::now()->subDays(14);
    }

    private function get($name)
    {
        return Arr::get($this->attributes, $name);
    }

    public function toArray(): array
    {
        return [
            'id' => $this->get('id'),
            'name' => $this->get('name'),
            'email' => $this->get('email'),
            'username' => $this->get('login'),
        ];
    }
}
{'fraction_non_alphanumeric': 0.14882381180988957, 'fraction_numerical': 0.0019203072491598655, 'mean_word_length': 2.372168284789644, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '5076936', 'n_tokens_mistral': 632, 'n_tokens_neox': 611, 'n_words': 125}