<commit_before><?php

namespace App\Tools;

use App\Shell;
use Illuminate\Support\Str;
use Symfony\Component\Process\ExecutableFinder;

class Takeout
{
    private $shell;
    private $finder;
    private $filterList;

    public function __construct(Shell $shell, ExecutableFinder $finder)
    {
        $this->shell = $shell;
        $this->finder = $finder;
    }

    public function list(): array
    {
        $process = $this->shell->execQuietly('takeout list --json');

        $containers = json_decode($process->getOutput(), true);

        if (empty($this->filterList)) {
            return $containers;
        }

        return collect($containers)->filter(function ($container) {
            return Str::contains($container['names'], $this->filterList);
        })->values()->all();
    }

    public function exists()
    {
        return ! is_null($this->finder->find('takeout'));
    }

    public function start(string $container)<commit_msg>style: use consistent naming<commit_after><?php

namespace App\Tools;

use App\Shell;
use Illuminate\Support\Str;
use Symfony\Component\Process\ExecutableFinder;

class Takeout
{
    private $shell;
    private $finder;
    private $filterList;

    public function __construct(Shell $shell, ExecutableFinder $finder)
    {
        $this->shell = $shell;
        $this->finder = $finder;
    }

    public function list(): array
    {
        $process = $this->shell->execQuietly('takeout list --json');

        $containers = json_decode($process->getOutput(), true);

        if (empty($this->filterList)) {
            return $containers;
        }

        return collect($containers)->filter(function ($container) {
            return Str::of($container['names'])->contains($this->filterList);
        })->values()->all();
    }

    public function find()
    {
        return ! is_null($this->finder->find('takeout'));
    }

    public function start(string $container)
{'fraction_non_alphanumeric': 0.14455343314403718, 'fraction_numerical': 0.0, 'mean_word_length': 2.8300395256916997, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '5484599', 'n_tokens_mistral': 552, 'n_tokens_neox': 545, 'n_words': 117}