| @@ 1684-1695 (lines=12) @@ | ||
| 1681 | * |
|
| 1682 | * @throws InvalidArgumentException |
|
| 1683 | */ |
|
| 1684 | public static function minCount($array, $min, $message = '') |
|
| 1685 | { |
|
| 1686 | static::isCountable($array); |
|
| 1687 | ||
| 1688 | if (\count($array) < $min) { |
|
| 1689 | static::reportInvalidArgument(\sprintf( |
|
| 1690 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
| 1691 | \count($array), |
|
| 1692 | $min |
|
| 1693 | )); |
|
| 1694 | } |
|
| 1695 | } |
|
| 1696 | ||
| 1697 | /** |
|
| 1698 | * @param mixed $array |
|
| @@ 1704-1715 (lines=12) @@ | ||
| 1701 | * |
|
| 1702 | * @throws InvalidArgumentException |
|
| 1703 | */ |
|
| 1704 | public static function maxCount($array, $max, $message = '') |
|
| 1705 | { |
|
| 1706 | static::isCountable($array); |
|
| 1707 | ||
| 1708 | if (\count($array) > $max) { |
|
| 1709 | static::reportInvalidArgument(\sprintf( |
|
| 1710 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
| 1711 | \count($array), |
|
| 1712 | $max |
|
| 1713 | )); |
|
| 1714 | } |
|
| 1715 | } |
|
| 1716 | ||
| 1717 | /** |
|
| 1718 | * @param mixed $array |
|