| Conditions | 7 |
| Paths | 32 |
| Total Lines | 48 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | protected function getValidations() { |
||
| 10 | $prefs = $this->service->getPreferenceLoader()->getSystemPreferences(); |
||
| 11 | |||
| 12 | $validations = []; |
||
| 13 | |||
| 14 | if ($prefs->getUserLogin() != SystemPreferences::LOGIN_EMAIL) { |
||
| 15 | $validations[] = [ |
||
| 16 | 'constraint' => 'notnull', |
||
| 17 | 'column' => 'user_name' |
||
| 18 | ]; |
||
| 19 | } |
||
| 20 | |||
| 21 | if ($prefs->getUserEmail() || $prefs->getUserLogin() != SystemPreferences::LOGIN_USERNAME) { |
||
| 22 | $validations[] = [ |
||
| 23 | 'constraint' => 'email', |
||
| 24 | 'column' => 'email' |
||
| 25 | ]; |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($prefs->getUserNames()) { |
||
| 29 | $validations[] = [ |
||
| 30 | 'constraint' => 'notnull', |
||
| 31 | 'column' => 'given_name' |
||
| 32 | ]; |
||
| 33 | |||
| 34 | $validations[] = [ |
||
| 35 | 'constraint' => 'notnull', |
||
| 36 | 'column' => 'family_name' |
||
| 37 | ]; |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($prefs->getUserBirth()) { |
||
| 41 | $validations[] = [ |
||
| 42 | 'constraint' => 'required', |
||
| 43 | 'column' => 'birth' |
||
| 44 | ]; |
||
| 45 | } |
||
| 46 | |||
| 47 | if ($prefs->getUserSex()) { |
||
| 48 | $validations[] = [ |
||
| 49 | 'constraint' => 'choice', |
||
| 50 | 'column' => 'sex', |
||
| 51 | 'choices' => [0, 1] |
||
| 52 | ]; |
||
| 53 | } |
||
| 54 | |||
| 55 | return $validations; |
||
| 56 | } |
||
| 57 | } |