From 104d7cff14688bd62f4055b2b8d64139c725f5ee Mon Sep 17 00:00:00 2001 From: chipslays Date: Sun, 16 Jul 2023 15:06:43 +0400 Subject: [PATCH] refactor: can pass as array list or key-value array for setting option --- helpers.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers.php b/helpers.php index c14918a..535e036 100644 --- a/helpers.php +++ b/helpers.php @@ -21,7 +21,11 @@ function option(string|array|null $key = null, mixed $default = null, DateInterv } if (is_array($key)) { - $option->set($key[0], $key[1], $ttl); + if (array_is_list($key)) { + $option->set($key[0], $key[1], $ttl); + } else { + $option->set(key($key), current($key), $ttl); + } } return $option;