web/lib/Zend/Console/Getopt.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
--- a/web/lib/Zend/Console/Getopt.php	Thu May 07 15:10:09 2015 +0200
+++ b/web/lib/Zend/Console/Getopt.php	Thu May 07 15:16:02 2015 +0200
@@ -15,9 +15,9 @@
  *
  * @category   Zend
  * @package    Zend_Console_Getopt
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Getopt.php 24593 2012-01-05 20:35:02Z matthew $
+ * @version    $Id$
  */
 
 /**
@@ -80,7 +80,7 @@
  *
  * @category   Zend
  * @package    Zend_Console_Getopt
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @version    Release: @package_version@
  * @since      Class available since Release 0.6.0
@@ -732,6 +732,28 @@
     }
 
     /**
+     * @throws Zend_Console_Getopt_Exception
+     */
+    public function checkRequiredArguments()
+    {
+        foreach ($this->_rules as $name => $rule) {
+            if ($rule['param'] === 'required') {
+                $defined = false;
+                foreach ($rule['alias'] as $alias) {
+                    $defined = $defined === true ? true : array_key_exists($alias, $this->_options);
+                }
+                if ($defined === false) {
+                    require_once 'Zend/Console/Getopt/Exception.php';
+                    throw new Zend_Console_Getopt_Exception(
+                        'Option "$alias" requires a parameter.',
+                        $this->getUsageMessage()
+                    );
+                }
+            }
+        }
+    }
+
+    /**
      * Parse command-line arguments for a single long option.
      * A long option is preceded by a double '--' character.
      * Long options may not be clustered.
@@ -789,7 +811,7 @@
         $realFlag = $this->_ruleMap[$flag];
         switch ($this->_rules[$realFlag]['param']) {
             case 'required':
-                if (count($argv) > 0) {
+                if (count($argv) > 0 && substr($argv[0], 0, 1) != '-') {
                     $param = array_shift($argv);
                     $this->_checkParameterType($realFlag, $param);
                 } else {