Completed
Push — refactoring ( 84ac1f...ab1ebc )
by Oleg
04:25
created

DisplayRule   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 24
wmc 3
lcom 1
cbo 0
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setDisplayRule() 0 4 1
A canDisplay() 0 8 2
1
<?php
2
3
namespace Malezha\Menu\Traits;
4
5
trait DisplayRule
6
{
7
    protected $rule = true;
8
9
    /**
10
     * @param mixed $rule
11
     */
12 1
    public function setDisplayRule($rule)
13
    {
14 1
        $this->rule = $rule;
15 1
    }
16
17
    /**
18
     * @return bool
19
     */
20 2
    public function canDisplay()
21
    {
22 2
        if (is_callable($this->rule)) {
23 1
            return (bool)call_user_func($this->rule);
24
        }
25
        
26 2
        return (bool)$this->rule;
27
    }
28
}