| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function rules() |
||
| 28 | { |
||
| 29 | $status_in = [ |
||
| 30 | User::STATUS_DISABLE, |
||
| 31 | User::STATUS_ENABLE, |
||
| 32 | ]; |
||
| 33 | $rule = [ |
||
| 34 | 'phone' => [ |
||
| 35 | 'required', |
||
| 36 | 'regex:/' . Regexp::PHONE . '/', |
||
| 37 | ], |
||
| 38 | 'status' => [ |
||
| 39 | Rule::in($status_in), |
||
| 40 | ], |
||
| 41 | ]; |
||
| 42 | if ($this->method() == 'POST') { |
||
| 43 | $rule['password'] = ['required', 'regex:/' . Regexp::PASSWORD . '/']; |
||
| 44 | } |
||
| 45 | |||
| 46 | return $rule; |
||
| 47 | } |
||
| 63 |