Passed
Push — v2 ( e7f8e2...a41bff )
by Daniel
04:01
created

ImagineMetadata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 34
ccs 0
cts 16
cp 0
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A removeFilter() 0 5 1
A setFilters() 0 5 2
A addFilter() 0 5 1
A getFilters() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\Dto\File;
15
16
use Doctrine\Common\Collections\ArrayCollection;
17
18
/**
19
 * @author Daniel West <[email protected]>
20
 */
21
class ImagineMetadata
22
{
23
    private ArrayCollection $filters;
24
25
    public function __construct()
26
    {
27
        $this->filters = new ArrayCollection();
28
    }
29
30
    public function addFilter(string $key, ImageMetadata $imageMetadata): self
31
    {
32
        $this->filters->set($key, $imageMetadata);
33
34
        return $this;
35
    }
36
37
    public function removeFilter(string $key): self
38
    {
39
        $this->filters->remove($key);
40
41
        return $this;
42
    }
43
44
    public function setFilters(array $filters)
45
    {
46
        $this->filters = new ArrayCollection();
47
        foreach ($filters as $key => $filter) {
48
            $this->addFilter($key, $filter);
49
        }
50
    }
51
52
    public function getFilters()
53
    {
54
        return $this->filters;
55
    }
56
}
57