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

YouShouldHave   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __call() 0 4 1
A youShouldAlways() 0 3 1
1
<?php
2
3
namespace Imanghafoori\HeyMan;
4
5
use Imanghafoori\HeyMan\Conditions\ConditionsFacade;
6
7
final class YouShouldHave
8
{
9
    use \Imanghafoori\HeyMan\Conditions\RequestValidation;
10
11
    public $condition;
12
13
    /**
14
     * @var Chain
15
     */
16
    private $chain;
17
18
    /**
19
     * YouShouldHave constructor.
20
     *
21
     * @param Chain $chain
22
     */
23 102
    public function __construct(Chain $chain)
24
    {
25 102
        $this->chain = $chain;
26 102
    }
27
28 3
    public function __call($method, $args)
29
    {
30 3
        resolve(Chain::class)->condition = (new ConditionsFacade($this->chain))->$method(...$args);
31
        return resolve(Otherwise::class);
32
    }
33 6
34
    public function youShouldAlways()
35 6
    {
36
        return $this->thisValueShouldAllow(false)->otherwise();
0 ignored issues
show
Bug introduced by
The method thisValueShouldAllow() does not exist on Imanghafoori\HeyMan\YouShouldHave. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

36
        return $this->/** @scrutinizer ignore-call */ thisValueShouldAllow(false)->otherwise();
Loading history...
37 6
    }
38
}
39