Completed
Pull Request — 2.0 (#1098)
by
unknown
08:50 queued 06:15
created

FilterSet::getQuality()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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