| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Anomaly\UsersModule\User\Command; |
||
| 41 | public function handle(UserRepositoryInterface $users, Guard $auth) |
||
| 42 | { |
||
| 43 | if (is_null($this->identifier)) { |
||
| 44 | return $auth->user(); |
||
| 45 | } |
||
| 46 | |||
| 47 | if (is_numeric($this->identifier)) { |
||
| 48 | return $users->find($this->identifier); |
||
| 49 | } |
||
| 50 | |||
| 51 | if (filter_var($this->identifier, FILTER_VALIDATE_EMAIL)) { |
||
| 52 | return $users->findByEmail($this->identifier); |
||
| 53 | } |
||
| 54 | |||
| 55 | if (!is_numeric($this->identifier)) { |
||
| 56 | return $users->findByUsername($this->identifier); |
||
| 57 | } |
||
| 58 | |||
| 59 | return null; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |