1 | <?php |
||
10 | class Path |
||
11 | { |
||
12 | /** |
||
13 | * @var \JumpGate\ViewResolution\Models\View |
||
14 | */ |
||
15 | public $viewModel; |
||
16 | |||
17 | /** |
||
18 | * @var \JumpGate\ViewResolution\Resolvers\Path |
||
19 | */ |
||
20 | public $path; |
||
21 | |||
22 | /** |
||
23 | * @var \JumpGate\ViewResolution\Resolvers\Layout|\Illuminate\View\View |
||
24 | */ |
||
25 | public $layout; |
||
26 | |||
27 | /** |
||
28 | * @var \Illuminate\Routing\Router |
||
29 | */ |
||
30 | protected $route; |
||
31 | |||
32 | /** |
||
33 | * @var \Illuminate\View\Factory |
||
34 | */ |
||
35 | protected $view; |
||
36 | |||
37 | /** |
||
38 | * @param \Illuminate\Routing\Router $route |
||
39 | * @param \Illuminate\View\Factory $view |
||
40 | */ |
||
41 | public function __construct(Router $route, Factory $view) |
||
46 | |||
47 | /** |
||
48 | * Set up the needed details for the view. |
||
49 | * |
||
50 | * @param \Illuminate\View\View $layout |
||
51 | * @param null|string $view |
||
52 | * |
||
53 | * @return \Illuminate\View\View |
||
54 | */ |
||
55 | public function setUp(View $layout, $view = null) |
||
63 | |||
64 | /** |
||
65 | * Get a valid view path save it. |
||
66 | * |
||
67 | * @param $view |
||
68 | */ |
||
69 | protected function setPath($view) |
||
83 | |||
84 | /** |
||
85 | * Put the found view inside the layout. |
||
86 | */ |
||
87 | protected function setContent() |
||
97 | |||
98 | /** |
||
99 | * Try to figure out a view based on the called action. |
||
100 | * |
||
101 | * @param $layout |
||
102 | * @param $parameters |
||
103 | * |
||
104 | * @return \Illuminate\View\View |
||
105 | */ |
||
106 | public function missingMethod($layout, $parameters) |
||
120 | |||
121 | /** |
||
122 | * Find a view based on the available details. |
||
123 | * |
||
124 | * This will look in the config and the route details to |
||
125 | * find a sensible place a view may be. |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | protected function findView() |
||
153 | } |
||
154 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: