Completed
Push — master ( 60fe7d...424c83 )
by Daniel
02:27
created

CallableListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php
2
/**
3
 * @package narrator
4
 */
5
6
7
namespace Mleko\Narrator\Listener;
8
9
10
class CallableListener implements \Mleko\Narrator\Listener
11
{
12
    /** @var callable */
13
    private $callable;
14
15
    /**
16
     * CallableListener constructor.
17
     * @param callable $callable
18
     */
19 2
    public function __construct(callable $callable)
20
    {
21 2
        $this->callable = $callable;
22 2
    }
23
24
    /**
25
     * @param object $event
26
     * @param \Mleko\Narrator\Meta $meta
27
     * @return mixed
28
     */
29 2
    public function handle($event, \Mleko\Narrator\Meta $meta)
30
    {
31 2
        return call_user_func_array($this->callable, [$event, $meta]);
32
    }
33
}
34