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.

SplObjectHashKeyGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateKey() 0 8 2
1
<?php
2
3
namespace EmanueleMinotto\TwigCacheBundle\KeyGenerator;
4
5
use Asm89\Twig\CacheExtension\CacheStrategy\KeyGeneratorInterface;
6
7
/**
8
 * Key generator based on spl_object_hash.
9
 *
10
 * @see https://github.com/asm89/twig-cache-extension#setup-1
11
 */
12
class SplObjectHashKeyGenerator implements KeyGeneratorInterface
13
{
14
    /**
15
     * Generate a cache key for a given value.
16
     *
17
     * @param mixed $value cached value
18
     *
19
     * @return string
20
     */
21
    public function generateKey($value)
22
    {
23
        if (is_object($value)) {
24
            return spl_object_hash($value);
25
        }
26
27
        return sha1(serialize($value));
28
    }
29
}
30