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 ( b2510c...ee0bb8 )
by
unknown
12:46
created

Assets::addJs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 4
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SleepingOwl\Admin\Templates;
4
5
use KodiCMS\Assets\Html;
6
use KodiCMS\Assets\Assets as BaseAssets;
7
use KodiCMS\Assets\Contracts\AssetElementInterface;
8
use SleepingOwl\Admin\Contracts\Template\Assets as AssetsContract;
9
10
class Assets extends BaseAssets implements AssetsContract
11
{
12
    /**
13
     * @var array
14
     */
15
    protected $globalVars = [];
16
17
    /**
18
     * Gets or sets javascript assets.
19
     *
20
     * @param bool|string  $handle
21
     * @param string       $src        Asset source
22
     * @param array|string $dependency Dependencies
23
     * @param bool         $footer     Whether to show in header or footer
24
     *
25
     * @return AssetElementInterface Setting returns asset array, getting returns asset HTML
26
     */
27 285
    public function addJs($handle = false, $src = null, $dependency = null, $footer = true)
28
    {
29 285
        return parent::addJs($handle, $src, $dependency, $footer);
30
    }
31
32
    /**
33
     * Добавление глобальной переменной.
34
     *
35
     * @param string $key
36
     * @param mixed $value
37
     *
38
     * @return self
39
     */
40
    public function putGlobalVar($key, $value)
41
    {
42
        $this->globalVars[$key] = $value;
43
44
        return $this;
45
    }
46
47
    /**
48
     * Получение массива глобальных перменных.
49
     *
50
     * @return array
51
     */
52
    public function globalVars()
53
    {
54
        return $this->globalVars;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function render()
61
    {
62
        return $this->renderGlobalVars().PHP_EOL.parent::render();
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function renderGlobalVars()
69
    {
70
        $json = json_encode($this->globalVars);
71
72
        return (new Html())->vars("{$this->namespace}.GlobalConfig = {$json};");
73
    }
74
}
75