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.

AbstractStrategy   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A detach() 0 7 2
A attach() 0 4 1
A shouldCacheCallback() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: bram
5
 * Date: 3-1-14
6
 * Time: 21:46
7
 */
8
9
namespace StrokerCache\Strategy;
10
11
use StrokerCache\Event\CacheEvent;
12
use Zend\EventManager\EventManagerInterface;
13
use Zend\EventManager\ListenerAggregateInterface;
14
use Zend\Stdlib\AbstractOptions;
15
16
abstract class AbstractStrategy extends AbstractOptions implements
17
    ListenerAggregateInterface,
18
    StrategyInterface
19
{
20
    /**
21
     * @var callable[]
22
     */
23
    protected $listeners = [];
24
25
    /**
26
     * {@inheritDoc}
27
     */
28
    public function detach(EventManagerInterface $events)
29
    {
30
        foreach ($this->listeners as $index => $callback) {
31
            $events->detach($callback);
32
            unset($this->listeners[$index]);
33
        }
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function attach(EventManagerInterface $events, $listener = 1)
40
    {
41
        $this->listeners[] = $events->attach(CacheEvent::EVENT_SHOULDCACHE, [$this, 'shouldCacheCallback'], 100);
42
    }
43
44
    /**
45
     * @param  CacheEvent $event
46
     * @return bool
47
     */
48
    public function shouldCacheCallback(CacheEvent $event)
49
    {
50
        return $this->shouldCache($event->getMvcEvent());
51
    }
52
}
53