| Total Complexity | 4 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class UserValidator |
||
| 11 | { |
||
| 12 | public function validate(User $user) |
||
| 13 | { |
||
| 14 | $verifiedColdDate = $this->getColdDownDate($user); |
||
| 15 | if ($verifiedColdDate->gt(Carbon::now())) { |
||
| 16 | throw new WebException("You can do it after email verified after {$verifiedColdDate}"); |
||
| 17 | } |
||
| 18 | } |
||
| 19 | |||
| 20 | public function isUserColdDown(User $user) |
||
| 21 | { |
||
| 22 | $verifiedColdDate = $this->getColdDownDate($user); |
||
| 23 | return $verifiedColdDate->lt(Carbon::now()); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function getColdDownDate(User $user): Carbon |
||
| 30 | } |
||
| 31 | } |
||
| 32 |