RuleNegate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __destruct() 0 4 1
A __invoke() 0 5 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