| @@ 162-171 (lines=10) @@ | ||
| 159 | * Validates the upper case requirements. |
|
| 160 | * @return boolean |
|
| 161 | */ |
|
| 162 | private function validateUpperCase() |
|
| 163 | { |
|
| 164 | $occurences = preg_match_all("/[A-Z]/", $this->configuration->checkString()); |
|
| 165 | ||
| 166 | if ($occurences >= $this->configuration->rules()->get(Plexity::RULE_UPPER)) { |
|
| 167 | return true; |
|
| 168 | } |
|
| 169 | ||
| 170 | return false; |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * Validates the lower case requirements. |
|
| @@ 177-186 (lines=10) @@ | ||
| 174 | * Validates the lower case requirements. |
|
| 175 | * @return boolean |
|
| 176 | */ |
|
| 177 | private function validateLowerCase() |
|
| 178 | { |
|
| 179 | $occurences = preg_match_all("/[a-z]/", $this->configuration->checkString()); |
|
| 180 | ||
| 181 | if ($occurences >= $this->configuration->rules()->get(Plexity::RULE_LOWER)) { |
|
| 182 | return true; |
|
| 183 | } |
|
| 184 | ||
| 185 | return false; |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * Validates the special character requirements. |
|
| @@ 216-222 (lines=7) @@ | ||
| 213 | * Validates the minimum string length requirements. |
|
| 214 | * @return boolean |
|
| 215 | */ |
|
| 216 | private function validateLengthMin() |
|
| 217 | { |
|
| 218 | if (strlen($this->configuration->checkString()) >= $this->configuration->rules()->get(Plexity::RULE_LENGTH_MIN)) { |
|
| 219 | return true; |
|
| 220 | } |
|
| 221 | return false; |
|
| 222 | } |
|
| 223 | ||
| 224 | /** |
|
| 225 | * Validates the maximum string length requirements. |
|
| @@ 228-234 (lines=7) @@ | ||
| 225 | * Validates the maximum string length requirements. |
|
| 226 | * @return boolean |
|
| 227 | */ |
|
| 228 | private function validateLengthMax() |
|
| 229 | { |
|
| 230 | if (strlen($this->configuration->checkString()) <= $this->configuration->rules()->get(Plexity::RULE_LENGTH_MAX)) { |
|
| 231 | return true; |
|
| 232 | } |
|
| 233 | return false; |
|
| 234 | } |
|
| 235 | ||
| 236 | /** |
|
| 237 | * Validates the not_in requirements. |
|
| @@ 240-246 (lines=7) @@ | ||
| 237 | * Validates the not_in requirements. |
|
| 238 | * @return boolean |
|
| 239 | */ |
|
| 240 | private function validateNotIn() |
|
| 241 | { |
|
| 242 | if (in_array($this->configuration->checkString(), (array)$this->configuration->rules()->get(Plexity::RULE_NOT_IN))) { |
|
| 243 | return false; |
|
| 244 | } |
|
| 245 | return true; |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| 249 | * Count the number of occurences of a character or string in a string. |
|