| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public function handle(Request $request, Closure $next) |
||
| 41 | { |
||
| 42 | // read the visitor ID header (set by the API users) |
||
| 43 | $visitorId = $request->header('visitor-id'); |
||
| 44 | |||
| 45 | if (!$visitorId) { |
||
| 46 | throw new MissingVisitorIdException(); |
||
| 47 | } |
||
| 48 | |||
| 49 | $user = $this->findUserByVisitorIdTask->run($visitorId); |
||
| 50 | |||
| 51 | if (!$user) { |
||
| 52 | abort(403); |
||
| 53 | } |
||
| 54 | |||
| 55 | // return the response |
||
| 56 | return $next($request); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |