| @@ 1412-1420 (lines=9) @@ | ||
| 1409 | * @param string|int $key |
|
| 1410 | * @param string $message |
|
| 1411 | */ |
|
| 1412 | public static function keyExists($array, $key, $message = '') |
|
| 1413 | { |
|
| 1414 | if (!(isset($array[$key]) || \array_key_exists($key, $array))) { |
|
| 1415 | static::reportInvalidArgument(\sprintf( |
|
| 1416 | $message ?: 'Expected the key %s to exist.', |
|
| 1417 | static::valueToString($key) |
|
| 1418 | )); |
|
| 1419 | } |
|
| 1420 | } |
|
| 1421 | ||
| 1422 | /** |
|
| 1423 | * @param array $array |
|
| @@ 1427-1435 (lines=9) @@ | ||
| 1424 | * @param string|int $key |
|
| 1425 | * @param string $message |
|
| 1426 | */ |
|
| 1427 | public static function keyNotExists($array, $key, $message = '') |
|
| 1428 | { |
|
| 1429 | if (isset($array[$key]) || \array_key_exists($key, $array)) { |
|
| 1430 | static::reportInvalidArgument(\sprintf( |
|
| 1431 | $message ?: 'Expected the key %s to not exist.', |
|
| 1432 | static::valueToString($key) |
|
| 1433 | )); |
|
| 1434 | } |
|
| 1435 | } |
|
| 1436 | ||
| 1437 | /** |
|
| 1438 | * Does not check if $array is countable, this can generate a warning on php versions after 7.2. |
|