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
ChangeTripImageCommand
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\Trip\Application\Command;
6
7use Symfony\Component\HttpFoundation\File\UploadedFile;
8
9/**
10 * Sets the trip banner, or removes it when $file is null. One command for both:
11 * they share the whole flow (owner check, unlink the previous file, save) and
12 * differ only in what the trip ends up pointing at.
13 *
14 * The uploaded file travels as-is so the handler can store it *after* the access
15 * check — validating and moving it in the controller would leave an orphan file
16 * whenever the caller turns out not to own the trip.
17 */
18final readonly class ChangeTripImageCommand
19{
20    public function __construct(
21        public string $tripId,
22        public string $userId,
23        public ?UploadedFile $file,
24    ) {
25    }
26}