allow to get arguments by index

This commit is contained in:
Dennis Eichhorn 2022-03-11 23:18:35 +01:00
parent c5cd5da5d9
commit 960fdfcfe9

View File

@ -269,6 +269,10 @@ final class ArrayUtils
*/ */
public static function getArg(string $id, array $args) : ?string 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) { if (($key = \array_search($id, $args)) === false || $key === \count($args) - 1) {
return null; return null;
} }