Completed
Push — master ( c45904...04afc3 )
by Iman
03:46
created

Condition::always()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\Core;
4
5
use Imanghafoori\HeyMan\Conditions\RequestValidation;
6
7
/**
8
 * Class YouShouldHave.
9
 *
10
 * @method Otherwise youShouldBeGuest($guard = null)
11
 * @method Otherwise youShouldBeLoggedIn($guard = null)
12
 * @method Otherwise thisGateShouldAllow($gate, ...$parameters)
13
 * @method Otherwise youShouldHaveRole(string $role)
14
 * @method Otherwise thisClosureShouldAllow(callable $callback, array $parameters = [])
15
 * @method Otherwise thisValueShouldAllow($value)
16
 * @method Otherwise thisMethodShouldAllow($callback, array $parameters = [])
17
 * @method Otherwise sessionShouldHave($key)
18
 */
19
final class Condition
20
{
21
    use RequestValidation;
22
23 105
    public function __call(string $method, $args): Otherwise
24
    {
25 105
        resolve('heyman.chain')->set('condition', resolve(ConditionsFacade::class)->_call($method, $args));
0 ignored issues
show
Bug introduced by
The method set() does not exist on Illuminate\Foundation\Application. ( Ignorable by Annotation )

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

25
        resolve('heyman.chain')->/** @scrutinizer ignore-call */ set('condition', resolve(ConditionsFacade::class)->_call($method, $args));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
27 105
        return resolve(Otherwise::class);
28
    }
29
30 74
    public function always()
31
    {
32 74
        return $this->thisValueShouldAllow(false)->otherwise();
33
    }
34
}
35