| @@ 1460-1469 (lines=10) @@ | ||
| 1457 | * @param mixed $min |
|
| 1458 | * @param string $message |
|
| 1459 | */ |
|
| 1460 | public static function minCount($array, $min, $message = '') |
|
| 1461 | { |
|
| 1462 | if (\count($array) < $min) { |
|
| 1463 | static::reportInvalidArgument(\sprintf( |
|
| 1464 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
| 1465 | \count($array), |
|
| 1466 | $min |
|
| 1467 | )); |
|
| 1468 | } |
|
| 1469 | } |
|
| 1470 | ||
| 1471 | /** |
|
| 1472 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|
| @@ 1478-1487 (lines=10) @@ | ||
| 1475 | * @param mixed $max |
|
| 1476 | * @param string $message |
|
| 1477 | */ |
|
| 1478 | public static function maxCount($array, $max, $message = '') |
|
| 1479 | { |
|
| 1480 | if (\count($array) > $max) { |
|
| 1481 | static::reportInvalidArgument(\sprintf( |
|
| 1482 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
| 1483 | \count($array), |
|
| 1484 | $max |
|
| 1485 | )); |
|
| 1486 | } |
|
| 1487 | } |
|
| 1488 | ||
| 1489 | /** |
|
| 1490 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|