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

YouShouldHave::youShouldBeLoggedIn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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