EventRouteRule   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 36
ccs 7
cts 7
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 3 1
A __construct() 0 4 1
A getHandler() 0 3 1
1
<?php
2
3
namespace Smoren\EventRouter\Structs;
4
5
use Smoren\EventRouter\Interfaces\EventConfigInterface;
6
use Smoren\EventRouter\Interfaces\EventRouteRuleInterface;
7
8
/**
9
 * EventRouteRule class
10
 */
11
class EventRouteRule implements EventRouteRuleInterface
12
{
13
    /**
14
     * @var EventConfigInterface event route condition
15
     */
16
    protected EventConfigInterface $config;
17
    /**
18
     * @var callable event handler
19
     */
20
    protected $handler;
21
22
    /**
23
     * EventRouteRule constructor
24
     * @param EventConfigInterface $config
25
     * @param callable $handler
26
     */
27 2
    public function __construct(EventConfigInterface $config, callable $handler)
28
    {
29 2
        $this->config = $config;
30 2
        $this->handler = $handler;
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36 2
    public function getConfig(): EventConfigInterface
37
    {
38 2
        return $this->config;
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44 2
    public function getHandler(): callable
45
    {
46 2
        return $this->handler;
47
    }
48
}
49