<commit_before><?php
declare(strict_types = 1);

namespace App\Handlers\Frontend\Profile\Character;

use App\Services\Auth\Auth;
use App\Services\Media\Character\Cloak\Image;

class DeleteCloakHandler
{
    /**
     * @var Auth
     */
    private $auth;

    public function __construct(Auth $auth)
    {
        $this->auth = $auth;
    }

    public function handle(): bool
    {
        $username = $this->auth->getUser()->getUsername();
        if (!Image::exists($username)) {
            return false;
        }

        return \File::delete(Image::absolutePath($username));
    }
}<commit_msg>Fixed the bug that did not allow to remove the cloak.<commit_after><?php
declare(strict_types = 1);

namespace App\Handlers\Frontend\Profile\Character;

use App\Services\Auth\Auth;
use App\Services\Media\Character\Cloak\Image;
use Illuminate\Filesystem\Filesystem;

class DeleteCloakHandler
{
    /**
     * @var Auth
     */
    private $auth;

    /**
     * @var Filesystem
     */
    private $filesystem;

    public function __construct(Auth $auth, Filesystem $filesystem)
    {
        $this->auth = $auth;
        $this->filesystem = $filesystem;
    }

    public function handle(): bool
    {
        $username = $this->auth->getUser()->getUsername();
        if (!Image::exists($username)) {
            return false;
        }

        return $this->filesystem->delete(Image::absolutePath($username));
    }
}
{'fraction_non_alphanumeric': 0.13853727144866385, 'fraction_numerical': 0.0014064697609001407, 'mean_word_length': 2.658097686375321, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '4503665', 'n_tokens_mistral': 434, 'n_tokens_neox': 424, 'n_words': 86}