| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function __invoke(Request $request) |
||
| 13 | { |
||
| 14 | $notification = $request->input('subscriptionNotification.notificationType'); |
||
| 15 | |||
| 16 | $jobConfigKey = NotificationType::JOBS[$notification]; |
||
| 17 | $jobClass = config("google-server-notifications.jobs.{$jobConfigKey}", null); |
||
| 18 | |||
| 19 | GoogleNotification::storeNotification($jobConfigKey, $request->input()); |
||
| 20 | |||
| 21 | if (is_null($jobClass)) { |
||
| 22 | throw new WebhookFailed('Job class does not exist'); |
||
| 23 | } |
||
| 24 | |||
| 25 | $job = new $jobClass($request->input()); |
||
| 26 | dispatch($job); |
||
| 27 | |||
| 28 | return response()->json(); |
||
|
|
|||
| 29 | } |
||
| 30 | } |
||
| 31 |
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: