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