RuleMatchName::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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