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.

VisibleCondition::isVisible()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SleepingOwl\Admin\Traits;
4
5
use Closure;
6
7
trait VisibleCondition
8
{
9
    /**
10
     * @var Closure|null
11
     */
12
    protected $visibleCondition;
13
14
    /**
15
     * @return bool
16
     */
17 1
    public function isVisible()
18
    {
19 1
        if (is_callable($this->visibleCondition)) {
20 1
            return (bool) call_user_func($this->visibleCondition, $this->getModel());
0 ignored issues
show
Bug introduced by
It seems like getModel() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

20
            return (bool) call_user_func($this->visibleCondition, $this->/** @scrutinizer ignore-call */ getModel());
Loading history...
21
        }
22
23
        return true;
24
    }
25
26
    /**
27
     * @param Closure $condition
28
     *
29
     * @return $this
30
     */
31 1
    public function setVisibilityCondition(Closure $condition)
32
    {
33 1
        $this->visibleCondition = $condition;
34
35 1
        return $this;
36
    }
37
}
38