HandlesVisibility::visibleWhen()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 1
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 6
rs 10
1
<?php
2
3
namespace Terranet\Administrator\Field\Traits;
4
5
trait HandlesVisibility
6
{
7
    /** @var null|\Closure */
8
    protected $when;
9
10
    /**
11
     * @return bool
12
     */
13
    public function visibleWhen(): bool
14
    {
15
        return $this->when ? $this->when->call($this, request()) : true;
0 ignored issues
show
Bug introduced by
The function request was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

15
        return $this->when ? $this->when->call($this, /** @scrutinizer ignore-call */ request()) : true;
Loading history...
16
    }
17
}
18