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.
Passed
Push — master ( 657dae...6ad569 )
by
unknown
09:55
created

DoublesFinder::run()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 46
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 46
rs 8.4751
cc 5
eloc 30
nc 6
nop 0
1
<?php
2
3
namespace app\backend\widgets\DoublesFinder;
4
5
use app\models\Property;
6
use app\models\PropertyStaticValues;
7
use devgroup\TagDependencyHelper\ActiveRecordHelper;
8
use yii\base\Widget;
9
use yii\caching\TagDependency;
10
11
class DoublesFinder extends Widget
12
{
13
    public function run()
14
    {
15
        $psvDoubledSlugs = \Yii::$app->cache->get('psvDoubledSlugs:data');
16
        if ($psvDoubledSlugs === false) {
17
            $psvDoubledSlugs = PropertyStaticValues::find()
18
                ->select(['slug'])
19
                ->groupBy('slug')
20
                ->having('COUNT(*) > 1')
21
                ->indexBy('slug')
22
                ->column();
23
            if (count($psvDoubledSlugs) > 0) {
24
                foreach ($psvDoubledSlugs as $psvSlug) {
25
                    $psvDoubledSlugs[$psvSlug] = Property::find()
26
                        ->select(['id', 'name', 'property_group_id'])
27
                        ->asArray(true)
28
                        ->where(
29
                            [
30
                                'id' => PropertyStaticValues::find()
31
                                    ->select('property_id')
32
                                    ->where(['slug' => $psvSlug])
33
                                    ->column()
34
                            ]
35
                        )
36
                        ->all();;
0 ignored issues
show
Coding Style introduced by
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
37
                }
38
                \Yii::$app->cache->set(
39
                    'psvDoubledSlugs',
40
                    $psvDoubledSlugs,
41
                    86400,
42
                    new TagDependency(
43
                        [
44
                            'tags' => ActiveRecordHelper::getCommonTag(PropertyStaticValues::class)
45
                        ]
46
                    )
47
                );
48
            }
49
        }
50
        if (count($psvDoubledSlugs) > 0) {
51
            echo $this->render(
52
                'doubles-finder',
53
                [
54
                    'psvDoubledSlugs' => $psvDoubledSlugs
55
                ]
56
            );
57
        }
58
    }
59
}
60