<commit_before><?php namespace App\Console\Commands;

use App\Nerds;
use App\LastTweet;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use TwitterAPIExchange;

class ProcessTweets extends Command
{

    /**
     * The console command name.
     *
     * @var string
     */
    protected $signature = 'nerds:process {test=false}';

    /**4
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Process Tweets Looking for beers.';

    /**
     *
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $nerds = $this->getNerds();

        foreach ($nerds as $nerd) {
            $this->info('Processing ' . $nerd->twitter);
            $tweets = $this->getTweets($nerd);

            if (count($tweets) > 0) {
                $this->info('Found ' . count($tweets) . ' for ' . $nerd->twitter);
                foreach ($tweets as $tweet) {
                    $this->parseTweets($tweet);
                }

                // update the since_id with the latest tweet in $tweets
                if ($this->argument('test') === 'false') {
                    $this->updateSince($tweets['0']->id, $nerd->twitter);
                }
            }
        }
    }

    public function getNerds()
    {
        return Nerds::all();
    }

    public function getSettings()
    {
        $settings = [
            'oauth_access_token' => env('oauth_access_token', ''),
            'oauth_access_token_secret' => env('oauth_access_token_secret', ''),
            'consumer_key' => env('consumer_key', ''),
            'consumer_secret' => env('consumer_secret', ''),
        ];<commit_msg>🚧 If tweets is not an array, don't count them<commit_after><?php namespace App\Console\Commands;

use App\Nerds;
use App\LastTweet;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use TwitterAPIExchange;

class ProcessTweets extends Command
{

    /**
     * The console command name.
     *
     * @var string
     */
    protected $signature = 'nerds:process {test=false}';

    /**4
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Process Tweets Looking for beers.';

    /**
     *
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $nerds = $this->getNerds();

        foreach ($nerds as $nerd) {
            $this->info('Processing ' . $nerd->twitter);
            $tweets = $this->getTweets($nerd);

            if (is_array($tweets)) {
                if (count($tweets) > 0) {
                    $this->info('Found ' . count($tweets) . ' for ' . $nerd->twitter);
                    foreach ($tweets as $tweet) {
                        $this->parseTweets($tweet);
                    }

                    // update the since_id with the latest tweet in $tweets
                    if ($this->argument('test') === 'false') {
                        $this->updateSince($tweets['0']->id, $nerd->twitter);
                    }
                }
            }
        }
    }

    public function getNerds()
    {
        return Nerds::all();
    }

    public function getSettings()
    {
        $settings = [
            'oauth_access_token' => env('oauth_access_token', ''),
            'oauth_access_token_secret' => env('oauth_access_token_secret', ''),
            'consumer_key' => env('consumer_key', ''),
            'consumer_secret' => env('consumer_secret', ''),
        ];
{'fraction_non_alphanumeric': 0.14251272435038842, 'fraction_numerical': 0.0016072863648540047, 'mean_word_length': 1.7496318114874816, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '2350037', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1103, 'n_words': 225}