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
Pull Request — development (#846)
by
unknown
08:14
created

Group   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 9

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setLabel() 0 5 1
A getModel() 0 3 1
A __construct() 0 5 1
A getLabel() 0 3 2
A setPrimary() 0 5 1
A getPrimary() 0 9 3
1
<?php
2
3
namespace SleepingOwl\Admin\Form\Related;
4
5
class Group extends \Illuminate\Support\Collection
6
{
7
    /**
8
     * @var \Illuminate\Database\Eloquent\Model
9
     */
10
    protected $model;
11
12
    /**
13
     * @var string|callable
14
     */
15
    protected $label;
16
17
    protected $primary;
18
19
    public function __construct(\Illuminate\Database\Eloquent\Model $model = null, $items = [])
20
    {
21
        $this->model = $model;
22
23
        parent::__construct($items);
24
    }
25
26
    /**
27
     * @return \Illuminate\Database\Eloquent\Model
28
     */
29
    public function getModel()
30
    {
31
        return $this->model;
32
    }
33
34
    public function getPrimary()
35
    {
36
        $primary = $this->primary;
37
38
        if (is_callable($primary)) {
39
            return $primary($this->getModel());
40
        }
41
42
        return $primary ?: optional($this->getModel())->getKey();
43
    }
44
45
    public function setPrimary($primary)
46
    {
47
        $this->primary = $primary;
48
49
        return $this;
50
    }
51
52
    /**
53
     * @param string $label
54
     *
55
     * @return $this
56
     */
57
    public function setLabel($label)
58
    {
59
        $this->label = $label;
60
61
        return $this;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getLabel()
68
    {
69
        return is_callable($this->label) ? $this->label($this) : $this->label;
0 ignored issues
show
Bug Best Practice introduced by
The expression return is_callable($this...l($this) : $this->label also could return the type callable which is incompatible with the documented return type string.
Loading history...
Bug introduced by
The method label() does not exist on SleepingOwl\Admin\Form\Related\Group. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

69
        return is_callable($this->label) ? $this->/** @scrutinizer ignore-call */ label($this) : $this->label;
Loading history...
70
    }
71
}
72