@@ -15,72 +15,179 @@ position: 2
15
15
16
16
Checks if the string contains only digits/alphabet/-/_ .
17
17
18
+ ``` php
19
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\AlphaDashRule()]);
20
+ ```
21
+
18
22
### AlphaNumericRule
19
23
20
24
Checks if the value is valid IP (using [ FILTER_VALIDATE_IP] ( https://www.php.net/manual/en/filter.filters.flags.php ) )
21
25
26
+ ``` php
27
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\AlphaNumericRule()]);
28
+ ```
29
+
22
30
### ArrayRule
23
31
24
- Checks if the given value is an array. Not needed if using ` getArray* ` methods.
32
+ > Not needed if using ` getArray* ` methods.
33
+
34
+ Checks if the given value is an array.
35
+
36
+ ``` php
37
+ $getValue->getArray('test', rules: [new \Wrkflow\GetValue\Rules\ArrayRule()]);
38
+ ```
25
39
26
40
### BetweenRule
27
41
28
42
> Uses SizeRule
29
43
30
- Checks if the array|float|int|bool|string|null is within max/min (int/float).
44
+ Checks if value is withing given range:
45
+
46
+ - array - count of items equals to given value
47
+ - float, int - equals to given value
48
+ - bool - equals to given value 1 (true) or 0 (false)
49
+ - string - length of string equals to given value
50
+
51
+ ``` php
52
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\BetweenRule(2, 3)]);
53
+ $getValue->getInt('test', rules: [new \Wrkflow\GetValue\Rules\BetweenRule(2, 3)]);
54
+ $getValue->getArray('test', rules: [new \Wrkflow\GetValue\Rules\BetweenRule(1, 4)]);
55
+ $getValue->getFloat('test', rules: [new \Wrkflow\GetValue\Rules\BetweenRule(1.0, 1.5)]);
56
+ ```
31
57
32
58
### BooleanRule
33
59
60
+ > Not needed while using getBool
61
+
34
62
Checks if the value is a boolean.
35
63
64
+ ``` php
65
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\BooleanRule()]);
66
+ ```
67
+
36
68
### EmailRule
37
69
38
- Checks if the value is valid e-mail (
39
- using [ FILTER_VALIDATE_EMAIL] ( https://www.php.net/manual/en/filter.filters.flags.php ) )
70
+ Checks if the value is valid e-mail.
71
+ Using [ FILTER_VALIDATE_EMAIL] ( https://www.php.net/manual/en/filter.filters.flags.php )
72
+
73
+ ``` php
74
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\EmailRule()]);
75
+ ```
40
76
41
77
### FloatRule
42
78
79
+ > Not needed if using ` getFloat* ` methods.
80
+
43
81
Checks if the value is a float.
44
82
83
+ ``` php
84
+ $getValue->getFloat('test', rules: [new \Wrkflow\GetValue\Rules\FloatRule()]);
85
+ ```
86
+
87
+ ### HexColorRule
88
+
89
+ Checks if the value is valid HEX color (alphanumeric string with 3 to 6 chars without or with #).
90
+
91
+ ``` php
92
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\HexColorRule()]);
93
+ ```
94
+
45
95
### IntegerRule
46
96
97
+ > Not needed if using ` getInt* ` methods.
98
+
47
99
Checks if the value is a integer.
48
100
101
+ ``` php
102
+ $getValue->getInt('test', rules: [new \Wrkflow\GetValue\Rules\IntegerRule()]);
103
+ ```
104
+
49
105
### IpRule
50
106
51
107
Checks if the value is valid IP (using [ FILTER_VALIDATE_IP] ( https://www.php.net/manual/en/filter.filters.flags.php ) )
52
108
109
+ ``` php
110
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\IpRule()]);
111
+ ```
112
+
53
113
### MaxRule
54
114
55
115
> Uses SizeRule
56
116
57
- Checks if the array|float|int|bool|string|null is equal or greater than given int/float value.
117
+ Checks if value is equal or greater than given int/float value.
118
+
119
+ - array - count of items equals to given value
120
+ - float, int - equals to given value
121
+ - bool - equals to given value 1 (true) or 0 (false)
122
+ - string - length of string equals to given value
123
+
124
+ ``` php
125
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\MaxRule(2)]);
126
+ $getValue->getInt('test', rules: [new \Wrkflow\GetValue\Rules\MaxRule(2)]);
127
+ $getValue->getArray('test', rules: [new \Wrkflow\GetValue\Rules\MaxRule(1)]);
128
+ $getValue->getFloat('test', rules: [new \Wrkflow\GetValue\Rules\MaxRule(1.0)]);
129
+ ```
58
130
59
131
### MinRule
60
132
61
- Checks if the array|float|int|bool|string|null is equal or lower than given int/float value.
133
+ Checks if value is equal or lower than given int/float value.
134
+
135
+ - array - count of items equals to given value
136
+ - float, int - equals to given value
137
+ - bool - equals to given value 1 (true) or 0 (false)
138
+ - string - length of string equals to given value
139
+
140
+ ``` php
141
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\MinRule(2)]);
142
+ $getValue->getInt('test', rules: [new \Wrkflow\GetValue\Rules\MinRule(2)]);
143
+ $getValue->getArray('test', rules: [new \Wrkflow\GetValue\Rules\MinRule(1)]);
144
+ $getValue->getFloat('test', rules: [new \Wrkflow\GetValue\Rules\MinRule(1.0)]);
145
+ ```
62
146
63
147
### NumericRule
64
148
149
+ > Not needed if using ` getInt* ` methods.
150
+
65
151
Checks if the value is a numeric.
66
152
153
+ ``` php
154
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\NumericRule()]);
155
+ ```
156
+
67
157
### RegexRule
68
158
69
159
Checks if value is valid against given regex.
70
160
161
+ ``` php
162
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\RegexRule('/[\d]+/')]);
163
+ ```
164
+
71
165
### SizeRule
72
166
73
- Checks if:
167
+ Checks if value is equal to given float/int value :
74
168
75
169
- array - count of items equals to given value
76
170
- float, int - equals to given value
77
171
- bool - equals to given value 1 (true) or 0 (false)
78
172
- string - length of string equals to given value
79
173
174
+ ``` php
175
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\SizeRule(2)]);
176
+ $getValue->getInt('test', rules: [new \Wrkflow\GetValue\Rules\SizeRule(2)]);
177
+ $getValue->getArray('test', rules: [new \Wrkflow\GetValue\Rules\SizeRule(1)]);
178
+ $getValue->getFloat('test', rules: [new \Wrkflow\GetValue\Rules\SizeRule(1.0)]);
179
+ ```
180
+
80
181
### StringRule
81
182
183
+ > Not needed if using ` getString* ` methods.
184
+
82
185
Checks if value is valid string.
83
186
187
+ ``` php
188
+ $getValue->getString('test', rules: [new \Wrkflow\GetValue\Rules\StringRule()]);
189
+ ```
190
+
84
191
### UrlRule
85
192
86
193
Checks if the value is valid URL (using [ FILTER_VALIDATE_URL] ( https://www.php.net/manual/en/filter.filters.flags.php ) )
0 commit comments