Example #1
0
 /**
  * Determine if an argument has been defined on the command line.
  *
  * This can be useful for making sure an argument is present on the command
  * line before parse()'ing them into argument objects.
  *
  * @param string $name
  * @param array $argv
  *
  * @return bool
  */
 public function defined($name, array $argv = null)
 {
     // The argument isn't defined if it's not defined by the calling code.
     if (!$this->exists($name)) {
         return false;
     }
     $argument = $this->arguments[$name];
     $command_arguments = $this->parser->arguments($argv);
     foreach ($command_arguments as $command_argument) {
         if ($this->isArgument($argument, $command_argument)) {
             return true;
         }
     }
     return false;
 }