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.

ShouldCacheStrategyListener::attach()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
/**
3
 * @author Bram Gerritsen [email protected]
4
 * @copyright (c) Bram Gerritsen 2013
5
 * @license http://opensource.org/licenses/mit-license.php
6
 */
7
8
namespace StrokerCache\Listener;
9
10
use StrokerCache\Event\CacheEvent;
11
use StrokerCache\Strategy\StrategyInterface;
12
use Zend\EventManager\AbstractListenerAggregate;
13
use Zend\EventManager\EventManagerInterface;
14
15
class ShouldCacheStrategyListener extends AbstractListenerAggregate
16
{
17
    /**
18
     * @var StrategyInterface
19
     */
20
    protected $strategy;
21
22
    /**
23
     * @param StrategyInterface $strategy
24
     */
25
    public function __construct(StrategyInterface $strategy)
26
    {
27
        $this->setStrategy($strategy);
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    public function attach(EventManagerInterface $events, $priority = 1)
34
    {
35
        $this->listeners[] = $events->attach(CacheEvent::EVENT_SHOULDCACHE, [$this, 'shouldCache'], 100);
36
    }
37
38
    /**
39
     * @param  CacheEvent $event
40
     * @return bool
41
     */
42
    public function shouldCache(CacheEvent $event)
43
    {
44
        return $this->getStrategy()->shouldCache($event->getMvcEvent());
45
    }
46
47
    /**
48
     * @param StrategyInterface $strategy
49
     */
50
    public function setStrategy($strategy)
51
    {
52
        $this->strategy = $strategy;
53
    }
54
55
    /**
56
     * @return StrategyInterface
57
     */
58
    public function getStrategy()
59
    {
60
        return $this->strategy;
61
    }
62
}
63