DeleteCoverAction::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace Mostafaznv\Larupload\Actions\Cover;
4
5
use Mostafaznv\Larupload\Enums\LaruploadFileType;
6
7
class DeleteCoverAction
8
{
9
    public function __construct(
10
        private readonly ?LaruploadFileType $type,
11
        protected array                     $output
12
    ) {}
13
14
    public static function make(?LaruploadFileType $type, array $output): self
15
    {
16
        return new self($type, $output);
17
    }
18
19
20
    public function run(): array
21
    {
22
        $this->output['cover'] = null;
23
24
        if ($this->type != LaruploadFileType::IMAGE) {
25
            $this->output['dominant_color'] = null;
26
        }
27
28
        return $this->output;
29
    }
30
}
31