ZendFrameworkDispatcher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 3
c 2
b 1
f 1
lcom 1
cbo 1
dl 0
loc 40
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getEventManager() 0 4 1
A dispatch() 0 4 1
1
<?php
2
/**
3
 * This file is part of phpab/phpab. (https://github.com/phpab/phpab)
4
 *
5
 * @link https://github.com/phpab/phpab for the canonical source repository
6
 * @copyright Copyright (c) 2015-2016 phpab. (https://github.com/phpab/)
7
 * @license https://raw.githubusercontent.com/phpab/phpab/master/LICENSE.md MIT
8
 */
9
10
namespace PhpAb\Event;
11
12
use Zend\EventManager\EventManager;
13
14
/**
15
 * A dispatcher that uses the Zend Framework Event manager to dispatch events.
16
 *
17
 * @package PhpAb
18
 */
19
class ZendFrameworkDispatcher implements DispatcherInterface
20
{
21
    /**
22
     * The event manager used to dispatch events.
23
     *
24
     * @var EventManager
25
     */
26
    private $eventManager;
27
28
    /**
29
     * Initializes a new instance of this class.
30
     *
31
     * @param EventManager $eventManager
32
     */
33 2
    public function __construct(EventManager $eventManager)
34
    {
35 2
        $this->eventManager = $eventManager;
36 2
    }
37
38
    /**
39
     * Gets the event manager.
40
     *
41
     * @return EventManager
42
     */
43 1
    public function getEventManager()
44
    {
45 1
        return $this->eventManager;
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     *
51
     * @param string $event The name of the Event which should be dispatched
52
     * @param array $options The options that should get passed to the callback
53
     */
54 1
    public function dispatch($event, $options)
55
    {
56 1
        return $this->eventManager->trigger($event, $this, $options);
57
    }
58
}
59