| @@ 1616-1624 (lines=9) @@ | ||
| 1613 | * |
|
| 1614 | * @throws InvalidArgumentException |
|
| 1615 | */ |
|
| 1616 | public static function keyExists($array, $key, $message = '') |
|
| 1617 | { |
|
| 1618 | if (!(isset($array[$key]) || \array_key_exists($key, $array))) { |
|
| 1619 | static::reportInvalidArgument(\sprintf( |
|
| 1620 | $message ?: 'Expected the key %s to exist.', |
|
| 1621 | static::valueToString($key) |
|
| 1622 | )); |
|
| 1623 | } |
|
| 1624 | } |
|
| 1625 | ||
| 1626 | /** |
|
| 1627 | * @param array $array |
|
| @@ 1633-1641 (lines=9) @@ | ||
| 1630 | * |
|
| 1631 | * @throws InvalidArgumentException |
|
| 1632 | */ |
|
| 1633 | public static function keyNotExists($array, $key, $message = '') |
|
| 1634 | { |
|
| 1635 | if (isset($array[$key]) || \array_key_exists($key, $array)) { |
|
| 1636 | static::reportInvalidArgument(\sprintf( |
|
| 1637 | $message ?: 'Expected the key %s to not exist.', |
|
| 1638 | static::valueToString($key) |
|
| 1639 | )); |
|
| 1640 | } |
|
| 1641 | } |
|
| 1642 | ||
| 1643 | /** |
|
| 1644 | * Checks if a value is a valid array key (int or string). |
|