Passed
Push — master ( 16cc56...d9bd57 )
by Iman
02:32
created

HeyMan   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
wmc 6
eloc 10
dl 0
loc 29
ccs 11
cts 13
cp 0.8462
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A forget() 0 3 1
A checkPoint() 0 3 1
A __call() 0 10 3
A condition() 0 3 1
1
<?php
2
3
namespace Imanghafoori\HeyMan;
4
5
use Imanghafoori\HeyMan\Switching\Turn;
6
use Imanghafoori\HeyMan\Conditions\ConditionsFacade;
7
use Imanghafoori\HeyMan\WatchingStrategies\SituationsProxy;
8
9
class HeyMan
10
{
11
    use Turn;
12
13 14
    public function forget(): Forget
14
    {
15 14
        return new Forget();
16
    }
17
18 106
    public function __call($method, $args)
19
    {
20 106
        resolve('heyman.chain')->startChain();
0 ignored issues
show
Bug introduced by
The method startChain() 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

20
        resolve('heyman.chain')->/** @scrutinizer ignore-call */ startChain();

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...
21
22 106
        if (config()->get('app.debug') and ! app()->environment('production')) {
0 ignored issues
show
introduced by
The method environment() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

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

22
        if (config()->get('app.debug') and ! app()->/** @scrutinizer ignore-call */ environment('production')) {
Loading history...
23
            $info = array_only(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1], ['file', 'line', 'args']);
24
            resolve('heyman.chain')->set('debugInfo', $info);
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

24
            resolve('heyman.chain')->/** @scrutinizer ignore-call */ set('debugInfo', $info);

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...
25
        }
26
27 106
        return  SituationsProxy::call($method, $args);
28
    }
29
30 2
    public function checkPoint(string $pointName)
31
    {
32 2
        event('heyman_checkpoint_'.$pointName);
33 1
    }
34
35 1
    public function condition(string $name, $callable)
36
    {
37 1
        app(ConditionsFacade::class)->define($name, $callable);
38 1
    }
39
}
40