| Conditions | 6 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 47 | public function handle($request, Closure $next) |
||
| 48 | { |
||
| 49 | if ($this->auth->guest()) { |
||
| 50 | if ($apiToken = $request->header('X-Gitamin-Token')) { |
||
| 51 | try { |
||
| 52 | $this->auth->onceUsingId(User::findByApiToken($apiToken)->id); |
||
| 53 | } catch (ModelNotFoundException $e) { |
||
| 54 | throw new HttpException(401); |
||
| 55 | } |
||
| 56 | } elseif ($request->getUser()) { |
||
| 57 | if ($this->auth->onceBasic() !== null) { |
||
| 58 | throw new HttpException(401); |
||
| 59 | } |
||
| 60 | } else { |
||
| 61 | throw new HttpException(401); |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 65 | return $next($request); |
||
| 66 | } |
||
| 67 | } |
||
| 68 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.