Completed
Push — master ( 6af785...cbc83f )
by Iman
05:36
created

Callbacks::thisClosureShouldAllow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Imanghafoori\HeyMan\Conditions;
4
5
trait Callbacks
6
{
7
8
    public function thisClosureShouldAllow(callable $callback, array $parameters = [])
9
    {
10
        return $this->thisMethodShouldAllow($callback, $parameters);
11
    }
12
13
    public function thisMethodShouldAllow($callback, array $parameters = [])
14
    {
15
        return function (...$payload) use ($callback, $parameters) {
16
            return (bool) app()->call($callback, array_merge($parameters, ...$payload));
17
        };
18
    }
19
20
    public function thisValueShouldAllow($value)
21
    {
22
        return function () use ($value) {
23
            return (bool) $value;
24
        };
25
    }
26
}