Test Failed
Push — fix/media-validation ( 3351fe )
by Ben
09:34
created

MediaRequest::getByKey()   A

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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace Thinktomorrow\Chief\Media\Application;
4
5
class MediaRequest
6
{
7
    const NEW = 'new';
8
    const REPLACE = 'replace';
9
    const DETACH = 'detach';
10
11
    /** @var array */
12
    private $items = [
13
        self::NEW     => [],
14
        self::REPLACE => [],
15
        self::DETACH  => [],
16
    ];
17
18
    public function add(string $key, MediaRequestInput $mediaRequest): self
19
    {
20
        $this->items[$key][] = $mediaRequest;
21
22
        return $this;
23
    }
24
25
    public function all(): array
26
    {
27
        return $this->items;
28
    }
29
30
    public function getByKey(string $key): array
31
    {
32
        return $this->items[$key];
33
    }
34
}
35