mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-05-25 18:58:39 +00:00
allow to get arguments by index
This commit is contained in:
parent
c5cd5da5d9
commit
960fdfcfe9
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user