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 ( 8bc62f...4296d1 )
by Alexsandr
05:11
created

DefaultController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 4
dl 0
loc 45
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B actionIndex() 0 42 6
1
<?php
2
/**
3
 * @link https://github.com/corpsepk/yii2-yandex-market-yml
4
 * @copyright Copyright (c) 2016 Corpsepk
5
 * @license http://opensource.org/licenses/MIT
6
 */
7
8
namespace corpsepk\yml\controllers;
9
10
use Yii;
11
use yii\web\Controller;
12
use corpsepk\yml\YandexMarketYml;
13
14
/**
15
 * @author Corpsepk
16
 * @package corpsepk\yml
17
 */
18
class DefaultController extends Controller
19
{
20
    public function actionIndex()
21
    {
22
        /**
23
         * @var YandexMarketYml $module
24
         */
25
        $module = $this->module;
26
27
        $ymlData = $module->cacheProvider->get($module->cacheKey);
28
29
        if (!$ymlData) {
30
            $shop = $module->buildShop();
31
            $shop->validate();
32
33
            if ($shop->hasErrors()) {
34
                $module->logErrors($shop);
35
36
                if (YII_ENV_DEV) {
37
                    // Render errors in `dev` environment
38
                    return $this->render('errors', ['shop' => $shop]);
39
                }
40
            }
41
42
            $ymlData = $module->buildYml($shop);
43
44
            // Build cache if no errors
45
            if (!$shop->hasErrors()) {
46
                $module->cacheProvider->set($module->cacheKey, $ymlData, $module->cacheExpire);
47
            }
48
        }
49
50
        Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
51
        $headers = Yii::$app->response->headers;
52
        $headers->add('Content-Type', 'application/xml');
53
54
        if ($module->enableGzip) {
55
            $ymlData = gzencode($ymlData);
56
            $headers->add('Content-Encoding', 'gzip');
57
            $headers->add('Content-Length', strlen($ymlData));
58
        }
59
60
        return $ymlData;
61
    }
62
}
63