| @@ 1559-1567 (lines=9) @@ | ||
| 1556 | * |
|
| 1557 | * @throws InvalidArgumentException |
|
| 1558 | */ |
|
| 1559 | public static function keyExists($array, $key, $message = '') |
|
| 1560 | { |
|
| 1561 | if (!(isset($array[$key]) || \array_key_exists($key, $array))) { |
|
| 1562 | static::reportInvalidArgument(\sprintf( |
|
| 1563 | $message ?: 'Expected the key %s to exist.', |
|
| 1564 | static::valueToString($key) |
|
| 1565 | )); |
|
| 1566 | } |
|
| 1567 | } |
|
| 1568 | ||
| 1569 | /** |
|
| 1570 | * @param array $array |
|
| @@ 1576-1584 (lines=9) @@ | ||
| 1573 | * |
|
| 1574 | * @throws InvalidArgumentException |
|
| 1575 | */ |
|
| 1576 | public static function keyNotExists($array, $key, $message = '') |
|
| 1577 | { |
|
| 1578 | if (isset($array[$key]) || \array_key_exists($key, $array)) { |
|
| 1579 | static::reportInvalidArgument(\sprintf( |
|
| 1580 | $message ?: 'Expected the key %s to not exist.', |
|
| 1581 | static::valueToString($key) |
|
| 1582 | )); |
|
| 1583 | } |
|
| 1584 | } |
|
| 1585 | ||
| 1586 | /** |
|
| 1587 | * Checks if a value is a valid array key (int or string). |
|