From: Michael Wallner Date: Fri, 8 May 2015 08:54:09 +0000 (+0200) Subject: add Cli\Args::toArray() X-Git-Tag: v4.0.0~13 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e458434f1a5539f1905e61835bed0123f1635067;p=pharext%2Fpharext add Cli\Args::toArray() --- diff --git a/src/pharext/Cli/Args.php b/src/pharext/Cli/Args.php index 38cfaca..07fa892 100644 --- a/src/pharext/Cli/Args.php +++ b/src/pharext/Cli/Args.php @@ -176,6 +176,16 @@ class Args implements \ArrayAccess } } + + public function toArray() { + $args = []; + foreach ($this->spec as $spec) { + $opt = $this->opt($spec[1]); + $args[$opt] = $this[$opt]; + } + return $args; + } + /** * Retreive the default argument of an option * @param string $o