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.

ProfilerStrategy::saveBlock()   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
namespace EmanueleMinotto\TwigCacheBundle\Strategy;
4
5
use Asm89\Twig\CacheExtension\CacheStrategyInterface;
6
use EmanueleMinotto\TwigCacheBundle\DataCollector\TwigCacheCollector;
7
8
/**
9
 * Wrapper used to profile cache usage.
10
 */
11
class ProfilerStrategy implements CacheStrategyInterface
12
{
13
    /**
14
     * @var CacheStrategyInterface
15
     */
16
    private $cacheStrategy;
17
18
    /**
19
     * @var TwigCacheCollector
20
     */
21
    private $dataCollector;
22
23
    /**
24
     * @param CacheStrategyInterface $cacheStrategy
25
     * @param TwigCacheCollector     $dataCollector
26
     */
27
    public function __construct(CacheStrategyInterface $cacheStrategy, TwigCacheCollector $dataCollector)
28
    {
29
        $this->cacheStrategy = $cacheStrategy;
30
        $this->dataCollector = $dataCollector;
31
32
        $dataCollector->setStrategyClass(get_class($cacheStrategy));
33
    }
34
35
    /**
36
     * Fetch the block for a given key.
37
     *
38
     * @param mixed $key
39
     *
40
     * @return mixed
41
     */
42
    public function fetchBlock($key)
43
    {
44
        $output = $this->cacheStrategy->fetchBlock($key);
45
        $this->dataCollector->addFetchBlock($key, $output);
46
47
        return $output;
48
    }
49
50
    /**
51
     * Generate a key for the value.
52
     *
53
     * @param string $annotation
54
     * @param mixed  $value
55
     *
56
     * @return mixed
57
     */
58
    public function generateKey($annotation, $value)
59
    {
60
        $this->dataCollector->addGenerateKey($annotation, $value);
61
62
        return $this->cacheStrategy->generateKey($annotation, $value);
63
    }
64
65
    /**
66
     * Save the contents of a rendered block.
67
     *
68
     * @param mixed  $key
69
     * @param string $block
70
     *
71
     * @return mixed
72
     */
73
    public function saveBlock($key, $block)
74
    {
75
        return $this->cacheStrategy->saveBlock($key, $block);
76
    }
77
}
78