Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Console\Input; Chris@0: Chris@0: use Symfony\Component\Console\Exception\InvalidArgumentException; Chris@0: use Symfony\Component\Console\Exception\RuntimeException; Chris@0: Chris@0: /** Chris@0: * InputInterface is the interface implemented by all input classes. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: interface InputInterface Chris@0: { Chris@0: /** Chris@0: * Returns the first argument from the raw parameters (not parsed). Chris@0: * Chris@14: * @return string|null The value of the first argument or null otherwise Chris@0: */ Chris@0: public function getFirstArgument(); Chris@0: Chris@0: /** Chris@0: * Returns true if the raw parameters (not parsed) contain a value. Chris@0: * Chris@0: * This method is to be used to introspect the input parameters Chris@0: * before they have been validated. It must be used carefully. Chris@14: * Does not necessarily return the correct result for short options Chris@14: * when multiple flags are combined in the same option. Chris@0: * Chris@0: * @param string|array $values The values to look for in the raw parameters (can be an array) Chris@0: * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal Chris@0: * Chris@0: * @return bool true if the value is contained in the raw parameters Chris@0: */ Chris@0: public function hasParameterOption($values, $onlyParams = false); Chris@0: Chris@0: /** Chris@0: * Returns the value of a raw option (not parsed). Chris@0: * Chris@0: * This method is to be used to introspect the input parameters Chris@0: * before they have been validated. It must be used carefully. Chris@14: * Does not necessarily return the correct result for short options Chris@14: * when multiple flags are combined in the same option. Chris@0: * Chris@0: * @param string|array $values The value(s) to look for in the raw parameters (can be an array) Chris@0: * @param mixed $default The default value to return if no result is found Chris@0: * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal Chris@0: * Chris@0: * @return mixed The option value Chris@0: */ Chris@0: public function getParameterOption($values, $default = false, $onlyParams = false); Chris@0: Chris@0: /** Chris@0: * Binds the current Input instance with the given arguments and options. Chris@17: * Chris@17: * @throws RuntimeException Chris@0: */ Chris@0: public function bind(InputDefinition $definition); Chris@0: Chris@0: /** Chris@0: * Validates the input. Chris@0: * Chris@0: * @throws RuntimeException When not enough arguments are given Chris@0: */ Chris@0: public function validate(); Chris@0: Chris@0: /** Chris@0: * Returns all the given arguments merged with the default values. Chris@0: * Chris@0: * @return array Chris@0: */ Chris@0: public function getArguments(); Chris@0: Chris@0: /** Chris@0: * Returns the argument value for a given argument name. Chris@0: * Chris@0: * @param string $name The argument name Chris@0: * Chris@17: * @return string|string[]|null The argument value Chris@0: * Chris@0: * @throws InvalidArgumentException When argument given doesn't exist Chris@0: */ Chris@0: public function getArgument($name); Chris@0: Chris@0: /** Chris@0: * Sets an argument value by name. Chris@0: * Chris@17: * @param string $name The argument name Chris@17: * @param string|string[]|null $value The argument value Chris@0: * Chris@0: * @throws InvalidArgumentException When argument given doesn't exist Chris@0: */ Chris@0: public function setArgument($name, $value); Chris@0: Chris@0: /** Chris@0: * Returns true if an InputArgument object exists by name or position. Chris@0: * Chris@0: * @param string|int $name The InputArgument name or position Chris@0: * Chris@0: * @return bool true if the InputArgument object exists, false otherwise Chris@0: */ Chris@0: public function hasArgument($name); Chris@0: Chris@0: /** Chris@0: * Returns all the given options merged with the default values. Chris@0: * Chris@0: * @return array Chris@0: */ Chris@0: public function getOptions(); Chris@0: Chris@0: /** Chris@0: * Returns the option value for a given option name. Chris@0: * Chris@0: * @param string $name The option name Chris@0: * Chris@17: * @return string|string[]|bool|null The option value Chris@0: * Chris@0: * @throws InvalidArgumentException When option given doesn't exist Chris@0: */ Chris@0: public function getOption($name); Chris@0: Chris@0: /** Chris@0: * Sets an option value by name. Chris@0: * Chris@17: * @param string $name The option name Chris@17: * @param string|string[]|bool|null $value The option value Chris@0: * Chris@0: * @throws InvalidArgumentException When option given doesn't exist Chris@0: */ Chris@0: public function setOption($name, $value); Chris@0: Chris@0: /** Chris@0: * Returns true if an InputOption object exists by name. Chris@0: * Chris@0: * @param string $name The InputOption name Chris@0: * Chris@0: * @return bool true if the InputOption object exists, false otherwise Chris@0: */ Chris@0: public function hasOption($name); Chris@0: Chris@0: /** Chris@0: * Is this input means interactive? Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function isInteractive(); Chris@0: Chris@0: /** Chris@0: * Sets the input interactivity. Chris@0: * Chris@0: * @param bool $interactive If the input should be interactive Chris@0: */ Chris@0: public function setInteractive($interactive); Chris@0: }