| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function rules() |
||
| 28 | { |
||
| 29 | $rules = [ |
||
| 30 | 'name' => 'required|max:50', |
||
| 31 | 'key' => ['required', 'max:100', 'regex:/^[\w]+$/'], |
||
| 32 | 'value' => 'max:2048', |
||
| 33 | 'type' => [ |
||
| 34 | Rule::in(array_keys(Config::$types)), |
||
| 35 | ], |
||
| 36 | ]; |
||
| 37 | if ((int) request()->input('type') === Config::TYPE_JSON) { |
||
| 38 | $rules['value'] = [ |
||
| 39 | 'required', |
||
| 40 | 'max:2048', |
||
| 41 | new JsonStr() |
||
| 42 | ]; |
||
| 43 | } |
||
| 44 | |||
| 45 | return $rules; |
||
| 46 | } |
||
| 62 |