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