From d050e298204b3347e9b32138904a95f4b55a0c3e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 17 Aug 2016 12:55:26 +0200 Subject: [PATCH] getArg trim and comment added --- Utils/ArrayUtils.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php index 10f8a8eba..b9d847c49 100644 --- a/Utils/ArrayUtils.php +++ b/Utils/ArrayUtils.php @@ -222,12 +222,27 @@ class ArrayUtils 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 + */ public static function getArg(string $id, array $args) { if(($key = array_search($id, $args)) === false || $key === count($args) - 1) { return null; } - return $args[$key+1]; + return trim($args[$key+1], '" '); } }