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