1 | <?php |
||
5 | trait RuleListTrait |
||
6 | { |
||
7 | /** |
||
8 | * Rules validated with Javascript. |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $clientRules = ['Accepted', 'After', 'Alpha', 'AlphaDash', |
||
13 | 'AlphaNum', 'Array', 'Before', 'Between', 'Boolean', 'Confirmed', 'Date', |
||
14 | 'DateFormat', 'Different', 'Digits', 'DigitsBetween', 'Email', 'Image', |
||
15 | 'In', 'Integer', 'Ip', 'Json', 'Max', 'Mimes', 'Min', 'NotIn', 'Numeric', |
||
16 | 'Regex', 'Required', 'RequiredIf', 'RequiredWith', 'RequiredWithAll', |
||
17 | 'RequiredWithout', 'RequiredWithoutAll', 'Same', 'Size', 'Sometimes', |
||
18 | 'String', 'Timezone', 'Url', ]; |
||
19 | |||
20 | /** |
||
21 | * Rules validated in Server-Side. |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $serverRules = ['ActiveUrl', 'Exists', 'Unique']; |
||
26 | |||
27 | /** |
||
28 | * Rules applyed to files. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $fileRules = ['Image', 'Mimes']; |
||
33 | |||
34 | /** |
||
35 | * Rule used to disable validations. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | private $disableJsValidationRule = 'NoJsValidation'; |
||
40 | |||
41 | /** |
||
42 | * Returns if rule is validated using Javascript. |
||
43 | * |
||
44 | * @param $rule |
||
45 | * |
||
46 | * @return bool |
||
47 | */ |
||
48 | 1 | protected function isImplemented($rule) |
|
52 | |||
53 | /** |
||
54 | * Check if rule must be validated in server-side. |
||
55 | * |
||
56 | * @param $rule |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | 9 | protected function isRemoteRule($rule) |
|
65 | |||
66 | /** |
||
67 | * Check if rule disables rule processing. |
||
68 | * |
||
69 | * @param $rule |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | 1 | protected function isDisableRule($rule) |
|
77 | |||
78 | /** |
||
79 | * Check if rules should be validated. |
||
80 | * |
||
81 | * @param $rules |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | 5 | protected function validationDisabled($rules) |
|
91 | |||
92 | /** |
||
93 | * Check if rules is for input file type. |
||
94 | * |
||
95 | * @param $rule |
||
96 | |||
97 | * @return bool |
||
98 | */ |
||
99 | 1 | protected function isFileRule($rule) |
|
103 | } |
||
104 |