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

RemoveBlocks::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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