| @@ 260-265 (lines=6) @@ | ||
| 257 | } |
|
| 258 | ||
| 259 | $strLen = null; |
|
| 260 | if ($min = $param->getMinLength()) { |
|
| 261 | $strLen = strlen($value); |
|
| 262 | if ($strLen < $min) { |
|
| 263 | $this->errors[] = "{$path} length must be greater than or equal to {$min}"; |
|
| 264 | } |
|
| 265 | } |
|
| 266 | if ($max = $param->getMaxLength()) { |
|
| 267 | if (($strLen ?: strlen($value)) > $max) { |
|
| 268 | $this->errors[] = "{$path} length must be less than or equal to {$max}"; |
|
| @@ 266-270 (lines=5) @@ | ||
| 263 | $this->errors[] = "{$path} length must be greater than or equal to {$min}"; |
|
| 264 | } |
|
| 265 | } |
|
| 266 | if ($max = $param->getMaxLength()) { |
|
| 267 | if (($strLen ?: strlen($value)) > $max) { |
|
| 268 | $this->errors[] = "{$path} length must be less than or equal to {$max}"; |
|
| 269 | } |
|
| 270 | } |
|
| 271 | ||
| 272 | } elseif ($type == 'array') { |
|
| 273 | $size = null; |
|
| @@ 274-279 (lines=6) @@ | ||
| 271 | ||
| 272 | } elseif ($type == 'array') { |
|
| 273 | $size = null; |
|
| 274 | if ($min = $param->getMinItems()) { |
|
| 275 | $size = count($value); |
|
| 276 | if ($size < $min) { |
|
| 277 | $this->errors[] = "{$path} must contain {$min} or more elements"; |
|
| 278 | } |
|
| 279 | } |
|
| 280 | if ($max = $param->getMaxItems()) { |
|
| 281 | if (($size ?: count($value)) > $max) { |
|
| 282 | $this->errors[] = "{$path} must contain {$max} or fewer elements"; |
|