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

Condition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 5 1
A always() 0 3 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