Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ChangeMyAvatarCommand
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace App\Identity\Application\Command;
6
7use Symfony\Component\HttpFoundation\File\UploadedFile;
8
9/**
10 * Sets the caller's avatar, or removes it when $file is null. One command for
11 * both, like the trip banner: they share the whole flow (load the user, unlink
12 * the previous file, save) and differ only in what the user ends up pointing at.
13 *
14 * The uploaded file travels as-is so the handler stores it only once the user is
15 * known to exist — validating and moving it in the controller would leave an
16 * orphan file behind whenever the request turns out not to be servable.
17 */
18final readonly class ChangeMyAvatarCommand
19{
20    public function __construct(
21        public string $userId,
22        public ?UploadedFile $file,
23    ) {
24    }
25}