SymfonyEventDispatcherAdapter::remove()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * This file is part of the bee4/events package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @copyright Bee4 2014
8
 * @author Stephane HULARD <[email protected]>
9
 * @package Bee4\Events\Adapters
10
 */
11
12
namespace Bee4\Events\Adapters;
13
14
use Symfony\Component\EventDispatcher\EventDispatcher;
15
16
/**
17
 * Bridge to the Symfony EventDispatcher implementation
18
 * @see https://github.com/symfony/EventDispatcher
19
 * @package BeeBot\Event\Adapters
20
 */
21
class SymfonyEventDispatcherAdapter extends AbstractDispatcherAdapter
22
{
23
    /**
24
     * Adapted dispatcher
25
     * @var Symfony\Component\EventDispatcher\EventDispatcher
26
     */
27
    protected $dispatcher;
28
29
    /**
30
     * @param Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
31
     */
32
    public function __construct(EventDispatcher $dispatcher)
33
    {
34
        $this->dispatcher = $dispatcher;
0 ignored issues
show
Documentation Bug introduced by
It seems like $dispatcher of type object<Symfony\Component...atcher\EventDispatcher> is incompatible with the declared type object<Bee4\Events\Adapt...atcher\EventDispatcher> of property $dispatcher.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
35
    }
36
37
    /**
38
     * @see AbstractDispatcherAdapter::add
39
     */
40
    public function add($name, callable $listener, $priority = 0)
41
    {
42 1
        $this->dispatcher->addListener($name, $listener, $priority);
43 1
        return $this;
44
    }
45
46
    /**
47
     * @see AbstractDispatcherAdapter::remove
48
     */
49
    public function remove($name, callable $listener)
50
    {
51 1
        $this->dispatcher->removeListener($name, $listener);
52 1
        return $this;
53
    }
54
55
    /**
56
     * @see AbstractDispatcherAdapter::get
57
     */
58
    public function get($name)
59
    {
60 1
        return $this->dispatcher->getListeners($name);
61
    }
62
}
63