| Conditions | 9 |
| Paths | 10 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 9 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 10 | public function checkPreAuth(UserInterface $user) { |
|
| 25 | 10 | ||
| 26 | } |
||
| 27 | 10 | ||
| 28 | 3 | public function checkPostAuth(UserInterface $user) { |
|
| 29 | if($user instanceof IcsAccessToken) { |
||
| 30 | $user = $user->getUser(); |
||
| 31 | 7 | } |
|
| 32 | 1 | ||
| 33 | if(!$user instanceof User) { |
||
| 34 | return; |
||
| 35 | 6 | } |
|
| 36 | 2 | ||
| 37 | if($user->isTeacher() && $user->getTeacher() === null) { |
||
| 38 | throw new InvalidAccountException('invalid_account.teacher'); |
||
| 39 | 4 | } |
|
| 40 | 1 | ||
| 41 | if($user->isStudent() && $user->getStudents()->count() !== 1) { |
||
| 42 | 3 | throw new InvalidAccountException('invalid_account.student'); |
|
| 43 | } |
||
| 44 | |||
| 45 | if($user->isParent() && $user->getStudents()->count() === 0) { |
||
| 49 | } |