| @@ 218-223 (lines=6) @@ | ||
| 215 | } |
|
| 216 | ||
| 217 | $strLen = null; |
|
| 218 | if ($min = $param->getMinLength()) { |
|
| 219 | $strLen = strlen($value); |
|
| 220 | if ($strLen < $min) { |
|
| 221 | $this->errors[] = "{$path} length must be greater than or equal to {$min}"; |
|
| 222 | } |
|
| 223 | } |
|
| 224 | if ($max = $param->getMaxLength()) { |
|
| 225 | if (($strLen ?: strlen($value)) > $max) { |
|
| 226 | $this->errors[] = "{$path} length must be less than or equal to {$max}"; |
|
| @@ 224-228 (lines=5) @@ | ||
| 221 | $this->errors[] = "{$path} length must be greater than or equal to {$min}"; |
|
| 222 | } |
|
| 223 | } |
|
| 224 | if ($max = $param->getMaxLength()) { |
|
| 225 | if (($strLen ?: strlen($value)) > $max) { |
|
| 226 | $this->errors[] = "{$path} length must be less than or equal to {$max}"; |
|
| 227 | } |
|
| 228 | } |
|
| 229 | ||
| 230 | } elseif ($type == 'array') { |
|
| 231 | ||
| @@ 233-238 (lines=6) @@ | ||
| 230 | } elseif ($type == 'array') { |
|
| 231 | ||
| 232 | $size = null; |
|
| 233 | if ($min = $param->getMinItems()) { |
|
| 234 | $size = count($value); |
|
| 235 | if ($size < $min) { |
|
| 236 | $this->errors[] = "{$path} must contain {$min} or more elements"; |
|
| 237 | } |
|
| 238 | } |
|
| 239 | if ($max = $param->getMaxItems()) { |
|
| 240 | if (($size ?: count($value)) > $max) { |
|
| 241 | $this->errors[] = "{$path} must contain {$max} or fewer elements"; |
|