mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 07:18:39 +00:00
getArg trim and comment added
This commit is contained in:
parent
aca0e8ff08
commit
d050e29820
|
|
@ -222,12 +222,27 @@ class ArrayUtils
|
||||||
return $csv;
|
return $csv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get array value by argument id.
|
||||||
|
*
|
||||||
|
* Useful for parsing command line parsing
|
||||||
|
*
|
||||||
|
* @param array $data Data to convert
|
||||||
|
* @param string $delimiter Delim to use
|
||||||
|
* @param string $enclosure Enclosure to use
|
||||||
|
* @param string $escape Escape to use
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
public static function getArg(string $id, array $args)
|
public static function getArg(string $id, array $args)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $args[$key+1];
|
return trim($args[$key+1], '" ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user