| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Anomaly\UsersModule\User\Password\Command; |
||
| 58 | public function handle(UserRepositoryInterface $users) |
||
| 59 | { |
||
| 60 | $user = $users->findByResetCode($this->code); |
||
| 61 | |||
| 62 | if (!$user) { |
||
| 63 | return false; |
||
| 64 | } |
||
| 65 | |||
| 66 | if ($user->getId() !== $this->user->getId()) { |
||
| 67 | return false; |
||
| 68 | } |
||
| 69 | |||
| 70 | $this->user->setAttribute('reset_code', null); |
||
| 71 | $this->user->setAttribute('password', $this->password); |
||
| 72 | |||
| 73 | $users->save($this->user); |
||
| 74 | |||
| 75 | return true; |
||
| 76 | } |
||
| 77 | } |
||
| 78 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.