From 171187e4d829f0cf0454a49bd4f2fc34eb26599e Mon Sep 17 00:00:00 2001 From: Fabien Villepinte Date: Thu, 8 Jun 2023 13:34:14 +0200 Subject: [PATCH] refactor: Simplify the detection of invalid options --- src/Html2Text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Html2Text.php b/src/Html2Text.php index 1763cb4..af7e9ae 100644 --- a/src/Html2Text.php +++ b/src/Html2Text.php @@ -39,7 +39,7 @@ public static function convert(string $html, $options = []): string { // check all options are valid foreach ($options as $key => $value) { - if (!in_array($key, array_keys(static::defaultOptions()))) { + if (!array_key_exists($key, static::defaultOptions())) { throw new \InvalidArgumentException("Unknown html2text option '$key'. Valid options are " . implode(',', static::defaultOptions())); } }