Completed
Push — config-reader ( 6b41c3 )
by
unknown
03:29
created

FilterSet   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 1
dl 0
loc 91
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getDataLoader() 0 4 1
A getQuality() 0 4 1
A getFilters() 0 4 1
A setName() 0 4 1
A setDataLoader() 0 4 1
A setQuality() 0 4 1
A setFilters() 0 9 3
1
<?php
2
/**
3
 * This file is part of the `liip/LiipImagineBundle` project.
4
 *
5
 * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
6
 *
7
 * For the full copyright and license information, please view the LICENSE.md
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Liip\ImagineBundle\Config;
12
13
use Liip\ImagineBundle\Exception\InvalidArgumentException;
14
15
final class FilterSet implements FilterSetInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
22
    /**
23
     * @var string
24
     */
25
    private $dataLoader;
26
27
    /**
28
     * @var int
29
     */
30
    private $quality;
31
32
    /**
33
     * @var FilterInterface[]
34
     */
35
    private $filters = [];
36
37
    /**
38
     * @return string
39
     */
40
    public function getName(): string
41
    {
42
        return $this->name;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getDataLoader(): string
49
    {
50
        return $this->dataLoader;
51
    }
52
53
    /**
54
     * @return int
55
     */
56
    public function getQuality(): int
57
    {
58
        return $this->quality;
59
    }
60
61
    /**
62
     * @return FilterInterface[]
63
     */
64
    public function getFilters(): array
65
    {
66
        return $this->filters;
67
    }
68
69
    /**
70
     * @param string $name
71
     */
72
    public function setName(string $name): void
73
    {
74
        $this->name = $name;
75
    }
76
77
    /**
78
     * @param string|null $dataLoader
79
     */
80
    public function setDataLoader($dataLoader): void
81
    {
82
        $this->dataLoader = (string)$dataLoader;
83
    }
84
85
    /**
86
     * @param int $quality
87
     */
88
    public function setQuality(int $quality): void
89
    {
90
        $this->quality = $quality;
91
    }
92
93
    /**
94
     * @param FilterInterface[] $filters
95
     */
96
    public function setFilters(array $filters): void
97
    {
98
        foreach ($filters as $filter) {
99
            if (!($filter instanceof FilterInterface)) {
100
                throw new InvalidArgumentException('Unknown filter provided.');
101
            }
102
        }
103
        $this->filters = $filters;
104
    }
105
}
106