FilterPathContainer   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A createWebp() 0 10 1
A getSource() 0 4 1
A getTarget() 0 4 1
A getOptions() 0 4 1
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