Total Complexity | 6 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | trait ViewHooks |
||
9 | { |
||
10 | /** |
||
11 | * @param array|string $views |
||
12 | * |
||
13 | * @return \Imanghafoori\HeyMan\YouShouldHave |
||
14 | */ |
||
15 | 14 | public function whenYouSeeViewFile(...$views) |
|
16 | { |
||
17 | 14 | $views = $this->normalizeView($views); |
|
18 | |||
19 | 13 | return $this->watchView($views); |
|
20 | } |
||
21 | |||
22 | /** |
||
23 | * @param array|string $views |
||
24 | * |
||
25 | * @return \Imanghafoori\HeyMan\YouShouldHave |
||
26 | */ |
||
27 | 14 | public function whenYouMakeView(...$views) |
|
28 | { |
||
29 | 14 | return $this->whenYouSeeViewFile(...$views); |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param $views |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | 14 | private function normalizeView(array $views): array |
|
38 | { |
||
39 | 14 | $views = $this->normalizeInput($views); |
|
|
|||
40 | |||
41 | $mapper = function ($view) { |
||
42 | 14 | $this->checkViewExists($view); |
|
43 | 14 | }; |
|
44 | |||
45 | 14 | array_walk($views, $mapper); |
|
46 | |||
47 | 13 | return $views; |
|
48 | } |
||
49 | |||
50 | 14 | private function checkViewExists($view) |
|
54 | } |
||
55 | 13 | } |
|
56 | |||
57 | 13 | private function watchView($view): YouShouldHave |
|
62 | } |
||
63 | } |
||
64 |
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.