FilterPathContainer::getTarget()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
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\Service;
13
14
final class FilterPathContainer
15
{
16
    /**
17
     * @var string
18
     */
19
    private $source;
20
21
    /**
22
     * @var string
23
     */
24
    private $target;
25
26
    /**
27
     * @var mixed[]
28
     */
29
    private $options;
30
31
    /**
32
     * @param mixed[] $options
33
     */
34
    public function __construct(string $source, string $target = '', array $options = [])
35
    {
36
        $this->source = $source;
37
        $this->target = '' !== $target ? $target : $source;
38
        $this->options = $options;
39
    }
40
41
    public function createWebp(array $options): self
42
    {
43
        return new self(
44
            $this->source,
45
            $this->target.'.webp',
46
            [
47
                'format' => 'webp',
48
            ] + $options + $this->options
49
        );
50
    }
51
52
    public function getSource(): string
53
    {
54
        return $this->source;
55
    }
56
57
    public function getTarget(): string
58
    {
59
        return $this->target;
60
    }
61
62
    /**
63
     * @return mixed[]
64
     */
65
    public function getOptions(): array
66
    {
67
        return $this->options;
68
    }
69
}
70