浏览代码

[Console] added hasOption and hasArgument to Input

Fabien Potencier 15 年之前
父节点
当前提交
165b9832fe
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24 0
      src/Symfony/Components/Console/Input/Input.php

+ 24 - 0
src/Symfony/Components/Console/Input/Input.php

@@ -129,6 +129,18 @@ abstract class Input implements InputInterface
     $this->arguments[$name] = $value;
     $this->arguments[$name] = $value;
   }
   }
 
 
+  /**
+   * Returns true if an InputArgument object exists by name or position.
+   *
+   * @param string|integer $name The InputArgument name or position
+   *
+   * @return Boolean true if the InputArgument object exists, false otherwise
+   */
+  public function hasArgument($name)
+  {
+    return $this->definition->hasArgument($name);
+  }
+
   /**
   /**
    * Returns the options values.
    * Returns the options values.
    *
    *
@@ -171,4 +183,16 @@ abstract class Input implements InputInterface
 
 
     $this->options[$name] = $value;
     $this->options[$name] = $value;
   }
   }
+
+  /**
+   * Returns true if an InputOption object exists by name.
+   *
+   * @param string $name The InputOption name
+   *
+   * @return Boolean true if the InputOption object exists, false otherwise
+   */
+  public function hasOption($name)
+  {
+    return $this->definition->hasOption($name);
+  }
 }
 }