| @@ 1659-1668 (lines=10) @@ | ||
| 1656 | * |
|
| 1657 | * @throws InvalidArgumentException |
|
| 1658 | */ |
|
| 1659 | public static function minCount($array, $min, $message = '') |
|
| 1660 | { |
|
| 1661 | if (\count($array) < $min) { |
|
| 1662 | static::reportInvalidArgument(\sprintf( |
|
| 1663 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
| 1664 | \count($array), |
|
| 1665 | $min |
|
| 1666 | )); |
|
| 1667 | } |
|
| 1668 | } |
|
| 1669 | ||
| 1670 | /** |
|
| 1671 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|
| @@ 1679-1688 (lines=10) @@ | ||
| 1676 | * |
|
| 1677 | * @throws InvalidArgumentException |
|
| 1678 | */ |
|
| 1679 | public static function maxCount($array, $max, $message = '') |
|
| 1680 | { |
|
| 1681 | if (\count($array) > $max) { |
|
| 1682 | static::reportInvalidArgument(\sprintf( |
|
| 1683 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
| 1684 | \count($array), |
|
| 1685 | $max |
|
| 1686 | )); |
|
| 1687 | } |
|
| 1688 | } |
|
| 1689 | ||
| 1690 | /** |
|
| 1691 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|