Skip to content

Commit

Permalink
refactor: can pass as array list or key-value array for setting option
Browse files Browse the repository at this point in the history
  • Loading branch information
chipslays committed Jul 16, 2023
1 parent 3473fbe commit 104d7cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 104d7cf

Please sign in to comment.