Completed
Push — master ( e306f1...c9eaa1 )
by Iman
05:24
created

HeyMan::ignore()   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
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\RouteHooks;
8
use Imanghafoori\HeyMan\Hooks\ViewHooks;
9
use Imanghafoori\HeyMan\WatchingStrategies\BasicEventManager;
10
11
class HeyMan
12
{
13
    use EloquentHooks, RouteHooks, ViewHooks, EventHooks;
14
15
    private $chain;
16
17
    /**
18
     * HeyMan constructor.
19
     *
20
     * @param \Imanghafoori\HeyMan\Chain $chain
21
     */
22 77
    public function __construct(Chain $chain)
23
    {
24 77
        $this->chain = $chain;
25 77
    }
26
27
    /**
28
     * @param $url
29
     *
30
     * @return array
31
     */
32 77
    private function normalizeInput(array $url): array
0 ignored issues
show
Unused Code introduced by
The method normalizeInput() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
33
    {
34 77
        return is_array($url[0]) ? $url[0] : $url;
35
    }
36
37
    /**
38
     * @param $eventName
39
     *
40
     * @return YouShouldHave
41
     */
42 5
    private function holdWhen($eventName): YouShouldHave
0 ignored issues
show
Unused Code introduced by
The method holdWhen() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
43
    {
44 5
        $this->chain->eventManager = app(BasicEventManager::class)->init($eventName);
0 ignored issues
show
Documentation Bug introduced by
It seems like app(Imanghafoori\HeyMan\...lass)->init($eventName) of type Imanghafoori\HeyMan\Watc...egies\BasicEventManager is incompatible with the declared type Imanghafoori\HeyMan\ListenerApplier of property $eventManager.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
46 5
        return app(YouShouldHave::class);
47
    }
48
49 11
    public function ignore(): Ignore
50
    {
51 11
        return app(Ignore::class);
52
    }
53
}
54