Completed
Push — master ( 5b8b4e...9f490d )
by Iman
07:14
created

HeyMan   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 37
rs 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A turnOn() 0 3 1
A turnOff() 0 3 1
A forget() 0 3 1
A __call() 0 6 3
1
<?php
2
3
namespace Imanghafoori\HeyMan;
4
5
use Imanghafoori\HeyMan\Hooks\EloquentHooks;
6
use Imanghafoori\HeyMan\Hooks\EventHooks;
7
use Imanghafoori\HeyMan\Hooks\ViewHooks;
8
use Imanghafoori\HeyMan\Normilizers\InputNormalizer;
9
use Imanghafoori\HeyMan\Situations\RouteSituations;
10
use Imanghafoori\HeyMan\Situations\ViewSituations;
11
12
class HeyMan
13
{
14
    use EloquentHooks, ViewHooks, EventHooks, InputNormalizer;
15
16
    private $chain;
17
18
    /**
19
     * HeyMan constructor.
20
     *
21
     * @param Chain $chain
22 102
     */
23
    public function __construct(Chain $chain)
24 102
    {
25 102
        $this->chain = $chain;
26
    }
27 15
28
    public function turnOff(): Consider
29 15
    {
30
        return new Consider('turnOff');
31
    }
32 1
33
    public function turnOn(): Consider
34 1
    {
35
        return new Consider('turnOn');
36
    }
37 13
38
    public function forget(): Forget
39 13
    {
40
        return new Forget();
41
    }
42
43
    public function __call($method, $args)
44
    {
45
        if (str_contains($method, ['Send', 'Url', 'Route', 'Action'])) {
46
            return app(RouteSituations::class)->$method(...$args);
47
        } elseif (str_contains($method, ['View'])) {
48
            return app(ViewSituations::class)->$method(...$args);
49
        }
50
    }
51
}
52