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

HeyMan::turnOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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