| @@ 1698-1706 (lines=9) @@ | ||
| 1695 | * |
|
| 1696 | * @throws InvalidArgumentException |
|
| 1697 | */ |
|
| 1698 | public static function keyExists($array, $key, $message = '') |
|
| 1699 | { |
|
| 1700 | if (!(isset($array[$key]) || \array_key_exists($key, $array))) { |
|
| 1701 | static::reportInvalidArgument(\sprintf( |
|
| 1702 | $message ?: 'Expected the key %s to exist.', |
|
| 1703 | static::valueToString($key) |
|
| 1704 | )); |
|
| 1705 | } |
|
| 1706 | } |
|
| 1707 | ||
| 1708 | /** |
|
| 1709 | * @psalm-pure |
|
| @@ 1717-1725 (lines=9) @@ | ||
| 1714 | * |
|
| 1715 | * @throws InvalidArgumentException |
|
| 1716 | */ |
|
| 1717 | public static function keyNotExists($array, $key, $message = '') |
|
| 1718 | { |
|
| 1719 | if (isset($array[$key]) || \array_key_exists($key, $array)) { |
|
| 1720 | static::reportInvalidArgument(\sprintf( |
|
| 1721 | $message ?: 'Expected the key %s to not exist.', |
|
| 1722 | static::valueToString($key) |
|
| 1723 | )); |
|
| 1724 | } |
|
| 1725 | } |
|
| 1726 | ||
| 1727 | /** |
|
| 1728 | * Checks if a value is a valid array key (int or string). |
|