DeleteCoverAction::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
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