| Total Complexity | 3 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 85.71% |
| Changes | 0 | ||
| 1 | <?php |
||
| 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()); |
|
|
|
|||
| 21 | } |
||
| 22 | |||
| 23 | return true; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param Closure $condition |
||
| 28 | * |
||
| 29 | * @return $this |
||
| 30 | */ |
||
| 31 | 1 | public function setVisibilityCondition(Closure $condition) |
|
| 36 | } |
||
| 37 | } |
||
| 38 |