| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function run($userId, $code) |
||
| 39 | { |
||
| 40 | // find the confirmation code of this user from the cache |
||
| 41 | $codeFromCache = $this->cache->get('user:email-confirmation-code:' . $userId); |
||
| 42 | |||
| 43 | // if code is valid |
||
| 44 | if (!$codeFromCache && $codeFromCache != $code) { |
||
| 45 | throw new InvalidConfirmationCodeException; |
||
| 46 | } |
||
| 47 | |||
| 48 | // remove the confirmation code from the cache |
||
| 49 | $this->cache->forget('user:email-confirmation-code:' . $userId); |
||
| 50 | |||
| 51 | return true; |
||
| 52 | } |
||
| 53 | } |
||
| 54 |