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.

Assets   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
eloc 18
c 0
b 0
f 0
dl 0
loc 69
ccs 6
cts 24
cp 0.25
rs 10
wmc 9

5 Methods

Rating   Name   Duplication   Size   Complexity  
A includePackage() 0 3 1
A addScript() 0 9 2
A withPackage() 0 9 2
A initializePackage() 0 4 2
A addStyle() 0 9 2
1
<?php
2
3
namespace SleepingOwl\Admin\Traits;
4
5
use KodiCMS\Assets\Facades\PackageManager;
6
7
trait Assets
8
{
9
    /**
10
     * @var \KodiCMS\Assets\Package
11
     */
12
    protected $package;
13
14
    /**
15
     * @param string $handle
16
     * @param string $script
17
     * @param array $dependency
18
     *
19
     * @return $this
20
     */
21
    public function addScript($handle, $script, array $dependency = [])
22
    {
23
        if (is_null($handle)) {
0 ignored issues
show
introduced by
The condition is_null($handle) is always false.
Loading history...
24
            $handle = $script;
25
        }
26
27
        $this->package->js($handle, $script, $dependency, true);
28
29
        return $this;
30
    }
31
32
    /**
33
     * @param string $handle
34
     * @param string $style
35
     * @param array $attributes
36
     *
37
     * @return $this
38
     */
39
    public function addStyle($handle, $style, array $attributes = [])
40
    {
41
        if (is_null($handle)) {
0 ignored issues
show
introduced by
The condition is_null($handle) is always false.
Loading history...
42
            $handle = $style;
43
        }
44
45
        $this->package->css($handle, $style, $attributes);
46
47
        return $this;
48
    }
49
50
    /**
51
     * @param string ... $package
52
     *
53
     * @return $this
54
     */
55
    public function withPackage($packages)
56
    {
57
        $packages = is_array($packages)
58
            ? $packages
59
            : func_get_args();
60
61
        $this->package->with($packages);
62
63
        return $this;
64
    }
65
66
    protected function initializePackage()
67 168
    {
68
        if (is_null($this->package = PackageManager::load(get_called_class()))) {
69 168
            $this->package = PackageManager::add(get_called_class());
70 168
        }
71 168
    }
72 168
73
    protected function includePackage()
74 11
    {
75
        app('sleeping_owl.meta')->loadPackage($this->package->getName());
76 11
    }
77
}
78