EventRouteRule::getConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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