| Conditions | 6 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6.288 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 20 | 22 | public function handle($request, Closure $next) |
|
|
|
|||
| 21 | { |
||
| 22 | 22 | if ($request->path() === config('auto-deploy.route')) { |
|
| 23 | 20 | if (!config('auto-deploy.require-ssl') || $request->secure()) { |
|
| 24 | 18 | $origin = $this->determineOrigin(); |
|
| 25 | 18 | if (null !== $origin) { |
|
| 26 | 16 | if ($origin->verify()) { |
|
| 27 | // set the origin type in the controller |
||
| 28 | 12 | $request->offsetSet('origin', $origin); |
|
| 29 | |||
| 30 | 12 | return $next($request); |
|
| 31 | } else { |
||
| 32 | 4 | abort(403, 'Forbidden. Could not verify the origin of the request.'); |
|
| 33 | } |
||
| 34 | } else { |
||
| 35 | 2 | abort(403, 'Forbidden. Could not determine the origin of the request.'); |
|
| 36 | } |
||
| 37 | } else { |
||
| 38 | 2 | abort(403, 'Forbidden. Webhook requests must be sent using SSL.'); |
|
| 39 | } |
||
| 40 | } |
||
| 41 | // Passthrough if it's not our specific route |
||
| 42 | 2 | return $next($request); |
|
| 43 | } |
||
| 44 | |||
| 61 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.