RuleNegate::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Dazzle\Channel\Router\RuleMatch;
4
5
use Dazzle\Channel\Protocol\ProtocolInterface;
6
7
class RuleNegate
8
{
9
    /**
10
     * @var callable
11
     */
12
    protected $rule;
13
14
    /**
15
     * @param callable $rule
16
     */
17 10
    public function __construct(callable $rule)
18
    {
19 10
        $this->rule = $rule;
20 10
    }
21
22
    /**
23
     *
24
     */
25 10
    public function __destruct()
26
    {
27 10
        unset($this->rule);
28 10
    }
29
30
    /**
31
     * @param string $name
32
     * @param ProtocolInterface $protocol
33
     * @return bool
34
     */
35 10
    public function __invoke($name, ProtocolInterface $protocol)
36
    {
37 10
        $call = $this->rule;
38 10
        return !$call($name, $protocol);
39
    }
40
}
41