<commit_before><?php namespace Modules\Media\Services;

use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Support\Facades\App;
use Modules\Media\Image\Imagy;
use Modules\Media\Repositories\FileRepository;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class FileService
{
    /**
     * @var FileRepository
     */
    private $file;
    /**
     * @var Repository
     */
    private $config;
    /**
     * @var Queue
     */
    private $queue;
    /**
     * @var Imagy
     */
    private $imagy;

    public function __construct(
        FileRepository $file,
        Repository $config,
        Queue $queue,
        Imagy $imagy)
    {
        $this->file = $file;
        $this->config = $config;
        $this->queue = $queue;
        $this->imagy = $imagy;
    }

    /**
     * @param UploadedFile $file
     * @return mixed
     */
    public function store(UploadedFile $file)
    {
        // Save the file info to db
        $savedFile = $this->file->createFromFile($file);

        // Move the uploaded file to files path
        $file->move(public_path() . $this->config->get('media::config.files-path'), $savedFile->filename);

        $this->createThumbnails($savedFile);

        return $savedFile;
    }

    /**
     * Create the necessary thumbnails for the given file
     * @param $savedFile
     */
    private function createThumbnails($savedFile)
    {
        $this->queue->push(function($job) use ($savedFile)
        {
            App::make('imagy')->createAll($savedFile->path);
            $job->delete();
        });
    }

}<commit_msg>Typehinting the job queue variable<commit_after><?php namespace Modules\Media\Services;

use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Queue\Jobs\Job;
use Illuminate\Support\Facades\App;
use Modules\Media\Image\Imagy;
use Modules\Media\Repositories\FileRepository;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class FileService
{
    /**
     * @var FileRepository
     */
    private $file;
    /**
     * @var Repository
     */
    private $config;
    /**
     * @var Queue
     */
    private $queue;
    /**
     * @var Imagy
     */
    private $imagy;

    public function __construct(
        FileRepository $file,
        Repository $config,
        Queue $queue,
        Imagy $imagy)
    {
        $this->file = $file;
        $this->config = $config;
        $this->queue = $queue;
        $this->imagy = $imagy;
    }

    /**
     * @param UploadedFile $file
     * @return mixed
     */
    public function store(UploadedFile $file)
    {
        // Save the file info to db
        $savedFile = $this->file->createFromFile($file);

        // Move the uploaded file to files path
        $file->move(public_path() . $this->config->get('media::config.files-path'), $savedFile->filename);

        $this->createThumbnails($savedFile);

        return $savedFile;
    }

    /**
     * Create the necessary thumbnails for the given file
     * @param $savedFile
     */
    private function createThumbnails($savedFile)
    {
        $this->queue->push(function(Job $job) use ($savedFile)
        {
            App::make('imagy')->createAll($savedFile->path);
            $job->delete();
        });
    }

}
{'fraction_non_alphanumeric': 0.13458056729028364, 'fraction_numerical': 0.0, 'mean_word_length': 2.2278481012658227, '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': '7186331', 'n_tokens_mistral': 1012, 'n_tokens_neox': 1014, 'n_words': 207}