public function testHasArgument() { $this->initializeArguments(); $definition = new InputDefinition(); $definition->addArguments(array($this->foo)); $this->assertTrue($definition->hasArgument('foo'), '->hasArgument() returns true if a InputArgument exists for the given name'); $this->assertFalse($definition->hasArgument('bar'), '->hasArgument() returns false if a InputArgument exists for the given name'); }
/** * Returns true if an InputArgument object exists by name or position. * * @param string|int $name The InputArgument name or position * * @return bool true if the InputArgument object exists, false otherwise */ public function hasArgument($name) { return $this->definition->hasArgument($name); }
/** * @param array $params * @param InputDefinition $definition * * @return array */ protected function filterComposerParams(array $params, InputDefinition $definition) { foreach ($params as $param => $value) { if (0 === strpos($param, "--")) { if (!$definition->hasOption(substr($param, 2))) { unset($params[$param]); } } else { if (!$definition->hasArgument($param)) { unset($params[$param]); } } } return $params; }