add Cli\Args::toArray()
authorMichael Wallner <mike@php.net>
Fri, 8 May 2015 08:54:09 +0000 (10:54 +0200)
committerMichael Wallner <mike@php.net>
Fri, 8 May 2015 08:54:09 +0000 (10:54 +0200)
src/pharext/Cli/Args.php

index 38cfaca80e862546f06f989e13d7c9844c6f46cb..07fa892fd68196fe0bccf9ea29aa8261230dbf0a 100644 (file)
@@ -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