GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 307738...eb711b )
by
unknown
03:26
created

Dispatcher::on()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 5
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 8
rs 9.4285
1
<?php
2
/**
3
 * See class comment
4
 *
5
 * PHP Version 5
6
 *
7
 * @category Netresearch
8
 * @package  Netresearch\Kite\Service
9
 * @author   Christian Opitz <[email protected]>
10
 * @license  http://www.netresearch.de Netresearch Copyright
11
 * @link     http://www.netresearch.de
12
 */
13
14
namespace Netresearch\Kite\Service\Event;
15
16
/**
17
 * Class EventDispatcher
18
 *
19
 * @category Netresearch
20
 * @package  Netresearch\Kite\Service
21
 * @author   Christian Opitz <[email protected]>
22
 * @license  http://www.netresearch.de Netresearch Copyright
23
 * @link     http://www.netresearch.de
24
 */
25
trait Dispatcher
26
{
27
    /**
28
     * @var array
29
     */
30
    private $listeners = [];
31
32
    /**
33
     * Dispatch an event
34
     *
35
     * @param Event|string $event The event or the name
36
     *
37
     * @return $this
38
     */
39
    public function trigger($event)
40
    {
41
        $args = func_get_args();
42
        if (!$event instanceof Event) {
43
            $event = $args[0] = new Event($event);
44
        }
45
        if (array_key_exists($event->getName(), $this->listeners)) {
46
            foreach ($this->listeners[$event->getName()] as $listener) {
47
                call_user_func_array($listener, $args);
48
                if ($event->isPropagationStopped()) {
49
                    break;
50
                }
51
            }
52
        }
53
        return $this;
54
    }
55
56
    /**
57
     * Register an event handler
58
     *
59
     * @param string   $event    The event name
60
     * @param callable $callback The callback to call
61
     *
62
     * @return $this
63
     */
64
    public function on($event, $callback)
65
    {
66
        if (!array_key_exists($event, $this->listeners)) {
67
            $this->listeners[$event] = [];
68
        }
69
        $this->listeners[$event][] = $callback;
70
        return $this;
71
    }
72
}
73
74
?>
75