Passed
Push — master ( aefa73...fefe4c )
by Gabriel
14:43
created

OneTimeListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 18
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ByTIC\EventDispatcher\ListenerProviders;
6
7
/**
8
 *
9
 */
10
class OneTimeListener implements Listener
11
{
12
    /**
13
     * @var callable
14
     */
15
    protected $listener;
16
17
    public function __construct(callable $listener)
18
    {
19
        $this->listener = $listener;
20
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function __invoke(object $event): void
26
    {
27
        call_user_func($this->listener, $event);
28
    }
29
}
30