| Conditions | 4 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | public function run($userId, $token = null) |
||
| 44 | { |
||
| 45 | if ($userId) { |
||
| 46 | $user = $this->findUserByIdTask->run($userId)->withToken(); |
||
| 47 | } else { |
||
| 48 | if ($token) { |
||
| 49 | $user = $this->getAuthenticatedUserTask->run()->withToken(); |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | if (!$user) { |
||
| 54 | throw new UserNotFoundException(); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $user; |
||
| 58 | } |
||
| 59 | |||
| 61 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: