| Total Complexity | 3 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class OneTimeTokensRepository implements OneTimeTokensRepositoryInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Create new one time token. |
||
| 11 | * |
||
| 12 | * @param array $attributes |
||
| 13 | * |
||
| 14 | * @return OneTimeToken |
||
| 15 | */ |
||
| 16 | public function create(array $attributes) |
||
| 17 | { |
||
| 18 | return OneTimeToken::create($attributes); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Get the first unused token for the given user & optional operation. |
||
| 23 | * |
||
| 24 | * @param int|string $userId |
||
| 25 | * @param string|null $operation |
||
| 26 | * |
||
| 27 | * @return OneTimeToken|null |
||
| 28 | */ |
||
| 29 | public function firstUnusedFor($userId, string $operation = null) |
||
| 30 | { |
||
| 31 | return OneTimeToken::unusedFor($userId, $operation)->first(); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Invalidate unused tokens for the given user & optional operation. |
||
| 36 | * |
||
| 37 | * @param int|string $userId |
||
| 38 | * @param string|null $operation |
||
| 39 | * |
||
| 40 | * @return mixed |
||
| 41 | */ |
||
| 42 | public function deleteUnusedFor($userId, string $operation = null) |
||
| 45 | } |
||
| 46 | } |
||
| 47 |