| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function __invoke(Request $request) |
||
| 14 | { |
||
| 15 | $jobConfigKey = NotificationType::{$request->input('notification_type')}(); |
||
| 16 | $this->determineValidRequest($request->input('password')); |
||
| 17 | |||
| 18 | AppleNotification::storeNotification($jobConfigKey, $request->input()); |
||
| 19 | |||
| 20 | $payload = NotificationPayload::createFromRequest($request); |
||
| 21 | |||
| 22 | $jobClass = config("appstore-server-notifications.jobs.{$jobConfigKey}", null); |
||
| 23 | |||
| 24 | if (is_null($jobClass)) { |
||
| 25 | throw WebhookFailed::jobClassDoesNotExist($jobConfigKey); |
||
| 26 | } |
||
| 27 | |||
| 28 | $job = new $jobClass($payload); |
||
| 29 | dispatch($job); |
||
| 30 | |||
| 31 | return response()->json(); |
||
|
|
|||
| 32 | } |
||
| 33 | |||
| 43 |
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: