SymfonyEventDispatcherAdapter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 71.43%

Importance

Changes 7
Bugs 1 Features 0
Metric Value
wmc 4
c 7
b 1
f 0
lcom 1
cbo 1
dl 0
loc 42
ccs 5
cts 7
cp 0.7143
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A add() 0 5 1
A remove() 0 5 1
A get() 0 4 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