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 — development-bs4 ( bc8456...b9684a )
by butschster
29:24 queued 19:50
created

Badge::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SleepingOwl\Admin\Navigation;
4
5
use KodiComponents\Support\HtmlAttributes;
6
7
class Badge extends \KodiComponents\Navigation\Badge
8
{
9
    // fix KodiComponents for bootstrap 4
10
    // http://bootstrap-4.ru/docs/4.0/migration/#labels-and-badges
11
    use HtmlAttributes;
12
13
    public function __construct($value = null, $priority = 0)
14
    {
15
        if (! is_null($value)) {
16
            $this->setValue($value);
17
        }
18
19
        $this->setPriority($priority);
20
21
        $this->setHtmlAttribute('class', 'badge');
22
    }
23
24
    // end fix
25
26
    /**
27
     * @param null $view
28
     */
29
    public $view;
30
31
    /**
32
     * @return array
33
     */
34
    public function toArray()
35
    {
36
        $value = $this->getValue();
37
38
        if (! $this->hasClassProperty('badge-', 'bg-')) {
39
            $this->setHtmlAttribute('class', 'badge-primary');
40
        }
41
42
        return [
43
            'value' => $value,
44
            'attributes' => $this->htmlAttributesToString(),
45
        ];
46
    }
47
48
    /**
49
     * @return null|string
50
     */
51
    public function getView()
52
    {
53
        if ($this->view) {
54
            return $this->view;
55
        }
56
57
        return '_partials.navigation.badge';
58
    }
59
60
    /**
61
     * @param $view
62
     */
63
    public function setView($view = null)
64
    {
65
        $this->view = $view;
66
    }
67
68
    /**
69
     * @param null $view
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $view is correct as it would always require null to be passed?
Loading history...
70
     * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
71
     */
72
    public function render($view = null)
73
    {
74
        return app('sleeping_owl.template')->view($this->getView(), $this->toArray());
0 ignored issues
show
Bug introduced by
The method view() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

74
        return app('sleeping_owl.template')->/** @scrutinizer ignore-call */ view($this->getView(), $this->toArray());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
75
    }
76
}
77