Conditions | 4 |
Paths | 6 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public function __invoke(Request $request) |
||
10 | { |
||
11 | $page = $request->page; |
||
12 | |||
13 | $packageController = package_namespace().'\Http\Controllers\Pages\\'.ucfirst($page->slug).'Controller'; |
||
14 | $projectController = 'App\Http\Controllers\Pages\\'.ucfirst($page->slug).'Controller'; |
||
15 | |||
16 | $controller = class_exists($projectController) |
||
17 | ? $projectController |
||
18 | : $packageController; |
||
19 | |||
20 | if (! view()->exists("duck-funk-core::{$page->slug}") && ! class_exists($controller)) { |
||
|
|||
21 | return abort(404); |
||
22 | } |
||
23 | |||
24 | if (! class_exists($controller)) { |
||
25 | return abort(404); |
||
26 | } |
||
27 | |||
28 | if (view()->exists("duck-funk-core::{$page->slug}")) { |
||
29 | $response = view("duck-funk-core::{$page->slug}")->with('page', $page); |
||
30 | } |
||
31 | |||
39 |
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: