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 ( b41112...24729b )
by
unknown
13:18
created

BackendGoogleFeedController::actionSettings()   B

Complexity

Conditions 6
Paths 4

Size

Total Lines 20
Code Lines 13

Duplication

Lines 20
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 20
loc 20
rs 8.8571
c 2
b 0
f 0
cc 6
eloc 13
nc 4
nop 0
1
<?php
2
3
namespace app\modules\shop\controllers;
4
5
6
use app\backend\components\BackendController;
7
use app\backgroundtasks\helpers\BackgroundTasks;
8
use app\components\Helper;
9
use app\modules\shop\models\GoogleFeed;
10
use Yii;
11
12
class BackendGoogleFeedController extends BackendController
13
{
14
15
16
    public $defaultAction = 'settings';
17
18
    /**
19
     * @return string|\yii\web\Response
20
     * @throws \yii\web\ServerErrorHttpException
21
     */
22 View Code Duplication
    public function actionSettings()
23
    {
24
        if (\Yii::$app->request->isPost) {
25
            $model = new GoogleFeed();
26
            if (Yii::$app->request->isPost && $model->load(Yii::$app->request->post()) && $model->validate()) {
27
                $model->saveConfig();
28
            } elseif ($model->hasErrors()) {
29
                Yii::$app->session->setFlash('error', Helper::formatModelErrors($model, '<br />'));
30
            }
31
            return $this->refresh();
32
        }
33
        $model = new GoogleFeed();
34
        $model->loadConfig();
35
        return $this->render(
36
            'settings',
37
            [
38
                'model' => $model
39
            ]
40
        );
41
    }
42
43
    /**
44
     * @return \yii\web\Response
45
     */
46 View Code Duplication
    public function actionCreate()
47
    {
48
        BackgroundTasks::addTask(
49
            [
50
                'name' => 'google_merchants_generate',
51
                'description' => 'Creating YML file',
52
                'action' => 'shop/google-merchants/generate',
53
                'params' => '',
54
                'init_event' => 'shop/google_merchants',
55
            ],
56
            [
57
                'create_notification' => true,
58
            ]
59
        );
60
61
        Yii::$app->session->setFlash('success', 'Task has been created.');
62
        return $this->redirect(['settings']);
63
    }
64
65
66
}