RemoveBlocks   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A mutate() 0 7 2
A add() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Everlution\AjaxcomBundle\Mutation;
6
7
use Everlution\Ajaxcom\Handler;
8
9
/**
10
 * Class RemoveBlocks.
11
 *
12
 * @author Ivan Barlog <[email protected]>
13
 */
14
class RemoveBlocks implements MutatorInterface
15
{
16
    /** @var string[] */
17
    private $removeBlocks = [];
18
19
    public function mutate(Handler $ajax): Handler
20
    {
21
        foreach ($this->removeBlocks as $selector) {
22
            $ajax->container($selector)->remove();
23
        }
24
25
        return $ajax;
26
    }
27
28
    public function add(string $selector): self
29
    {
30
        $this->removeBlocks[] = $selector;
31
32
        return $this;
33
    }
34
}
35