<commit_before><?php

namespace FireflyIII\Helpers\Attachments;

use Auth;
use Config;
use Crypt;
use FireflyIII\Models\Attachment;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\MessageBag;
use Input;
use Symfony\Component\HttpFoundation\File\UploadedFile;

/**
 * Class AttachmentHelper
 *
 * @package FireflyIII\Helpers\Attachments
 */
class AttachmentHelper implements AttachmentHelperInterface
{

    /** @var int */
    protected $maxUploadSize;
    /** @var array */
    protected $allowedMimes;
    /** @var MessageBag */
    public $errors;
    /** @var MessageBag */
    public $messages;

    /**
     *
     */
    public function __construct()
    {
        $this->maxUploadSize = Config::get('firefly.maxUploadSize');
        $this->allowedMimes  = Config::get('firefly.allowedMimes');
        $this->errors        = new MessageBag;
        $this->messages      = new MessageBag;
    }

    /**
     * @param Attachment $attachment
     *
     * @return string
     */
    public function getAttachmentLocation(Attachment $attachment)
    {
        $path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';

        return $path;
    }

    /**
     * @param Model $model
     *
     * @return bool
     */
    public function saveAttachmentsForModel(Model $model)
    {
        $files = Input::file('attachments');

        if (is_array($files)) {
            foreach ($files as $entry) {
                if (!is_null($entry)) {
                    $this->processFile($entry, $model);
                }
            }
        } else {
            $this->processFile($files, $model);
        }

        return true;
    }
<commit_msg>null check.<commit_after><?php

namespace FireflyIII\Helpers\Attachments;

use Auth;
use Config;
use Crypt;
use FireflyIII\Models\Attachment;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\MessageBag;
use Input;
use Symfony\Component\HttpFoundation\File\UploadedFile;

/**
 * Class AttachmentHelper
 *
 * @package FireflyIII\Helpers\Attachments
 */
class AttachmentHelper implements AttachmentHelperInterface
{

    /** @var int */
    protected $maxUploadSize;
    /** @var array */
    protected $allowedMimes;
    /** @var MessageBag */
    public $errors;
    /** @var MessageBag */
    public $messages;

    /**
     *
     */
    public function __construct()
    {
        $this->maxUploadSize = Config::get('firefly.maxUploadSize');
        $this->allowedMimes  = Config::get('firefly.allowedMimes');
        $this->errors        = new MessageBag;
        $this->messages      = new MessageBag;
    }

    /**
     * @param Attachment $attachment
     *
     * @return string
     */
    public function getAttachmentLocation(Attachment $attachment)
    {
        $path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';

        return $path;
    }

    /**
     * @param Model $model
     *
     * @return bool
     */
    public function saveAttachmentsForModel(Model $model)
    {
        $files = Input::file('attachments');

        if (is_array($files)) {
            foreach ($files as $entry) {
                if (!is_null($entry)) {
                    $this->processFile($entry, $model);
                }
            }
        } else {
            if (!is_null($files)) {
                $this->processFile($files, $model);
            }
        }

        return true;
    }

{'fraction_non_alphanumeric': 0.1304474142940151, 'fraction_numerical': 0.0, 'mean_word_length': 2.150045745654163, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5440907', 'n_tokens_mistral': 1009, 'n_tokens_neox': 1001, 'n_words': 201}