From 960fdfcfe988843e60271ea7250fa6c24788942c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 11 Mar 2022 23:18:35 +0100 Subject: [PATCH] allow to get arguments by index --- Utils/ArrayUtils.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 24ffa5c92..04de37098 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -269,6 +269,10 @@ final class ArrayUtils */ public static function getArg(string $id, array $args) : ?string { + if (\is_numeric($id)) { + return $args[(int) $id] ?? null; + } + if (($key = \array_search($id, $args)) === false || $key === \count($args) - 1) { return null; }