Passed
Push — main ( 38d056...7e7092 )
by Oscar
12:07
created

RemoveAttributesProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
c 0
b 0
f 0
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 7 2
1
<?php
2
3
/*
4
 * This file is part of ocubom/twig-svg-extension
5
 *
6
 * © Oscar Cubo Medina <https://ocubom.github.io>
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
namespace Ocubom\Twig\Extension\Svg\Processor;
13
14
class RemoveAttributesProcessor implements ProcessorInterface
15
{
16
    /** @var string[] */
17
    private array $names;
18
19 3
    public function __construct(string ...$names)
20
    {
21 3
        $this->names = $names;
22
    }
23
24 12
    public function __invoke(\DOMElement $svg, array $options = []): \DOMElement
25
    {
26 12
        foreach ($this->names as $name) {
27 12
            $svg->removeAttribute($name);
28
        }
29
30 12
        return $svg;
31
    }
32
}
33