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.
Test Setup Failed
Push — filters ( 0da638...f31b5a )
by
unknown
16:04
created

IdentityMap   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B findById() 0 30 4
1
<?php
2
3
namespace app\traits;
4
5
use Yii;
6
use yii\caching\TagDependency;
7
8
/**
9
 * Trait IdentityMap is similar to FindById trait but also uses identity map pattern.
10
 * @package app\traits
11
 */
12
trait IdentityMap
13
{
14
    public static $identity_map = [];
15
16
    public static function findById($id)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
17
    {
18
        if (!isset(static::$identity_map[$id])) {
19
            $cache_key = static::className() . ':' . $id;
20
21
            static::$identity_map[$id] = Yii::$app->cache->get($cache_key);
22
            if (static::$identity_map[$id] === false) {
23
                static::$identity_map[$id] = static::findOne($id);
24
25
                if (is_object(static::$identity_map[$id])) {
26
27
                    Yii::$app->cache->set(
28
                        static::className() . ":" . $id,
29
                        static::$identity_map[$id],
30
                        86400,
31
                        new TagDependency(
32
                            [
33
                                'tags' => [
34
                                    \devgroup\TagDependencyHelper\ActiveRecordHelper::getObjectTag(static::className(), static::$identity_map[$id]->id),
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 152 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
35
                                ],
36
                            ]
37
                        )
38
                    );
39
                }
40
            }
41
42
            return static::$identity_map[$id];
43
        }
44
        return static::$identity_map[$id];
45
    }
46
}