Passed
Push — main ( 77e259...371264 )
by Oscar
08:09 queued 06:34
created

RemoveAttributeProcessor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 5 1
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 RemoveAttributeProcessor implements ProcessorInterface
15
{
16
    private string $name;
17
18
    /**
19
     * @param string $name Attribute to delete
20
     */
21 1
    public function __construct(string $name)
22
    {
23 1
        $this->name = $name;
24
    }
25
26 5
    public function __invoke(\DOMElement $svg, array $options = []): \DOMElement
27
    {
28 5
        $svg->removeAttribute($this->name);
29
30 5
        return $svg;
31
    }
32
}
33