DeleteCoverAction   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 3 1
A run() 0 9 2
A __construct() 0 4 1
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