| @@ 1509-1518 (lines=10) @@ | ||
| 1506 | * @param mixed $min |
|
| 1507 | * @param string $message |
|
| 1508 | */ |
|
| 1509 | public static function minCount($array, $min, $message = '') |
|
| 1510 | { |
|
| 1511 | if (\count($array) < $min) { |
|
| 1512 | static::reportInvalidArgument(\sprintf( |
|
| 1513 | $message ?: 'Expected an array to contain at least %2$d elements. Got: %d', |
|
| 1514 | \count($array), |
|
| 1515 | $min |
|
| 1516 | )); |
|
| 1517 | } |
|
| 1518 | } |
|
| 1519 | ||
| 1520 | /** |
|
| 1521 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|
| @@ 1527-1536 (lines=10) @@ | ||
| 1524 | * @param mixed $max |
|
| 1525 | * @param string $message |
|
| 1526 | */ |
|
| 1527 | public static function maxCount($array, $max, $message = '') |
|
| 1528 | { |
|
| 1529 | if (\count($array) > $max) { |
|
| 1530 | static::reportInvalidArgument(\sprintf( |
|
| 1531 | $message ?: 'Expected an array to contain at most %2$d elements. Got: %d', |
|
| 1532 | \count($array), |
|
| 1533 | $max |
|
| 1534 | )); |
|
| 1535 | } |
|
| 1536 | } |
|
| 1537 | ||
| 1538 | /** |
|
| 1539 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|