Passed
Push — master ( fe64ef...2e5fa1 )
by Ivan
02:01
created

RemoveBlocks::mutate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 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