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.
Completed
Push — master ( 32827b...8dd213 )
by Baptiste
02:19
created

StrategyCachingCapabilities::getCacheKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Innmind\Reflection\Cache;
4
5
/**
6
 * Strategy caching based on object class and key of method/property.
7
 *
8
 * @author Hugues Maignol <[email protected]>
9
 */
10
trait StrategyCachingCapabilities
11
{
12
    private static $strategyCache = [];
13
14
    /**
15
     * The cached strategy for the given class and property.
16
     *
17
     * @param string $class
18
     * @param string $key
19
     *
20
     * @return mixed|null
21
     */
22 8
    private function getCachedStrategy(string $class, string $key)
23
    {
24 8
        return self::$strategyCache[$this->getCacheKey($class, $key)] ?? null;
25
    }
26
27
    /**
28
     * @param string $class
29
     * @param string $key
30
     * @param mixed  $strategy
31
     *
32
     * @return self
33
     */
34 5
    private function setCachedStrategy(string $class, string $key, $strategy): self
35
    {
36 5
        self::$strategyCache[$this->getCacheKey($class, $key)] = $strategy;
37
38 5
        return $this;
39
    }
40
41
    /**
42
     * Computes cache key for class and property.
43
     *
44
     * @param string $class
45
     * @param string $key
46
     *
47
     * @return string
48
     */
49 8
    private function getCacheKey(string $class, string $key): string
50
    {
51 8
        return $class . '::' . $key;
52
    }
53
}
54