| @@ 1652-1661 (lines=10) @@ | ||
| 1649 | * |
|
| 1650 | * @throws InvalidArgumentException |
|
| 1651 | */ |
|
| 1652 | public static function minCount($array, $min, $message = '') |
|
| 1653 | { |
|
| 1654 | if (\count($array) < $min) { |
|
| 1655 | static::reportInvalidArgument(\sprintf( |
|
| 1656 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
| 1657 | \count($array), |
|
| 1658 | $min |
|
| 1659 | )); |
|
| 1660 | } |
|
| 1661 | } |
|
| 1662 | ||
| 1663 | /** |
|
| 1664 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|
| @@ 1672-1681 (lines=10) @@ | ||
| 1669 | * |
|
| 1670 | * @throws InvalidArgumentException |
|
| 1671 | */ |
|
| 1672 | public static function maxCount($array, $max, $message = '') |
|
| 1673 | { |
|
| 1674 | if (\count($array) > $max) { |
|
| 1675 | static::reportInvalidArgument(\sprintf( |
|
| 1676 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
| 1677 | \count($array), |
|
| 1678 | $max |
|
| 1679 | )); |
|
| 1680 | } |
|
| 1681 | } |
|
| 1682 | ||
| 1683 | /** |
|
| 1684 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|