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.

EventProvider::getEventManager()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
ccs 4
cts 4
cp 1
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
namespace HtImgModule\EventManager;
3
4
use Zend\EventManager\EventManagerAwareInterface;
5
use Zend\EventManager\EventManagerInterface;
6
use Zend\EventManager\EventManager;
7
8
abstract class EventProvider implements EventManagerAwareInterface
9
{
10
    /**
11
     * @var EventManagerInterface
12
     */
13
    protected $events;
14
15
    /**
16
     * Set the event manager instance used by this context
17
     *
18
     * @param  EventManagerInterface $events
19
     * @return mixed
20
     */
21 2
    public function setEventManager(EventManagerInterface $events)
22
    {
23 2
        $identifiers = array(__CLASS__, get_called_class());
24 2
        $events->setIdentifiers($identifiers);
25 2
        $this->events = $events;
26
27 2
        return $this;
28
    }
29
30
    /**
31
     * Retrieve the event manager
32
     *
33
     * Lazy-loads an EventManager instance if none registered.
34
     *
35
     * @return EventManagerInterface
36
     */
37 2
    public function getEventManager()
38
    {
39 2
        if (!$this->events instanceof EventManagerInterface) {
40 2
            $this->setEventManager(new EventManager());
41
        }
42
43 2
        return $this->events;
44
    }
45
}
46