Completed
Push — master ( 3c1051...50a607 )
by Iman
09:32
created

ViewSituations::normalizeView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\HeyMan\Situations;
4
5
use Imanghafoori\HeyMan\Normilizers\ViewNormalizer;
6
use Imanghafoori\HeyMan\WatchingStrategies\ViewEventManager;
7
use Imanghafoori\HeyMan\YouShouldHave;
8
9
class ViewSituations extends BaseSituation
10
{
11
    use ViewNormalizer;
12
13
    /**
14
     * @param array|string $views
15
     *
16
     * @return YouShouldHave
17
     */
18
    public function whenYouMakeView(...$views): YouShouldHave
19
    {
20
        return $this->watchView($this->normalizeView($views));
21 19
    }
22
23 19
    private function watchView($view): YouShouldHave
24 19
    {
25
        $this->chain->eventManager = app(ViewEventManager::class)->init($view);
0 ignored issues
show
Documentation Bug introduced by
It seems like app(Imanghafoori\HeyMan\...er::class)->init($view) of type Imanghafoori\HeyMan\Watc...tegies\ViewEventManager 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...
26
27
        return app(YouShouldHave::class);
28
    }
29
}
30