| @@ 1626-1635 (lines=10) @@ | ||
| 1623 | * |
|
| 1624 | * @throws InvalidArgumentException |
|
| 1625 | */ |
|
| 1626 | public static function minCount($array, $min, $message = '') |
|
| 1627 | { |
|
| 1628 | if (\count($array) < $min) { |
|
| 1629 | static::reportInvalidArgument(\sprintf( |
|
| 1630 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
| 1631 | \count($array), |
|
| 1632 | $min |
|
| 1633 | )); |
|
| 1634 | } |
|
| 1635 | } |
|
| 1636 | ||
| 1637 | /** |
|
| 1638 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|
| @@ 1646-1655 (lines=10) @@ | ||
| 1643 | * |
|
| 1644 | * @throws InvalidArgumentException |
|
| 1645 | */ |
|
| 1646 | public static function maxCount($array, $max, $message = '') |
|
| 1647 | { |
|
| 1648 | if (\count($array) > $max) { |
|
| 1649 | static::reportInvalidArgument(\sprintf( |
|
| 1650 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
| 1651 | \count($array), |
|
| 1652 | $max |
|
| 1653 | )); |
|
| 1654 | } |
|
| 1655 | } |
|
| 1656 | ||
| 1657 | /** |
|
| 1658 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|