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.

HighchartsAsset::withScripts()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.0534
c 0
b 0
f 0
cc 4
eloc 10
nc 8
nop 1
1
<?php
2
3
/**
4
 * HighchartsAsset class file.
5
 *
6
 * @author Milo Schuman <[email protected]>
7
 * @link https://github.com/miloschuman/yii2-highcharts/
8
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
9
 */
10
11
namespace miloschuman\highcharts;
12
13
use yii\web\AssetBundle;
14
15
/**
16
 * Asset bundle for Highcharts and Highstock widget.
17
 */
18
class HighchartsAsset extends AssetBundle
19
{
20
21
    public $sourcePath = '@vendor/miloschuman/yii2-highcharts-widget/src/assets';
22
    public $depends = ['yii\web\JqueryAsset'];
23
24
    /**
25
     * Registers additional JavaScript files required by the widget.
26
     *
27
     * @param array $scripts list of additional JavaScript files to register.
28
     * @return $this
29
     */
30
    public function withScripts($scripts = ['highcharts'])
31
    {
32
        // use unminified files when in debug mode
33
        $ext = YII_DEBUG ? 'src.js' : 'js';
34
35
        // add files
36
        foreach ($scripts as $script) {
37
            $this->js[] = "$script.$ext";
38
        }
39
40
        // make sure that either highcharts or highstock base file is included.
41
        array_unshift($this->js, "highcharts.$ext");
42
        $hasHighstock = in_array("highstock.$ext", $this->js);
43
        if ($hasHighstock) {
44
            array_unshift($this->js, "highstock.$ext");
45
            // remove highcharts if highstock is used on page
46
            $this->js = array_diff($this->js, ["highcharts.$ext"]);
47
        }
48
49
        return $this;
50
    }
51
}
52