4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Console\Input;
14 use Symfony\Component\Console\Exception\InvalidArgumentException;
15 use Symfony\Component\Console\Exception\RuntimeException;
18 * InputInterface is the interface implemented by all input classes.
20 * @author Fabien Potencier <fabien@symfony.com>
22 interface InputInterface
25 * Returns the first argument from the raw parameters (not parsed).
27 * @return string The value of the first argument or null otherwise
29 public function getFirstArgument();
32 * Returns true if the raw parameters (not parsed) contain a value.
34 * This method is to be used to introspect the input parameters
35 * before they have been validated. It must be used carefully.
37 * @param string|array $values The values to look for in the raw parameters (can be an array)
39 * @return bool true if the value is contained in the raw parameters
41 public function hasParameterOption($values);
44 * Returns the value of a raw option (not parsed).
46 * This method is to be used to introspect the input parameters
47 * before they have been validated. It must be used carefully.
49 * @param string|array $values The value(s) to look for in the raw parameters (can be an array)
50 * @param mixed $default The default value to return if no result is found
52 * @return mixed The option value
54 public function getParameterOption($values, $default = false);
57 * Binds the current Input instance with the given arguments and options.
59 * @param InputDefinition $definition A InputDefinition instance
61 public function bind(InputDefinition $definition);
64 * Validates the input.
66 * @throws RuntimeException When not enough arguments are given
68 public function validate();
71 * Returns all the given arguments merged with the default values.
75 public function getArguments();
78 * Returns the argument value for a given argument name.
80 * @param string $name The argument name
82 * @return mixed The argument value
84 * @throws InvalidArgumentException When argument given doesn't exist
86 public function getArgument($name);
89 * Sets an argument value by name.
91 * @param string $name The argument name
92 * @param string $value The argument value
94 * @throws InvalidArgumentException When argument given doesn't exist
96 public function setArgument($name, $value);
99 * Returns true if an InputArgument object exists by name or position.
101 * @param string|int $name The InputArgument name or position
103 * @return bool true if the InputArgument object exists, false otherwise
105 public function hasArgument($name);
108 * Returns all the given options merged with the default values.
112 public function getOptions();
115 * Returns the option value for a given option name.
117 * @param string $name The option name
119 * @return mixed The option value
121 * @throws InvalidArgumentException When option given doesn't exist
123 public function getOption($name);
126 * Sets an option value by name.
128 * @param string $name The option name
129 * @param string|bool $value The option value
131 * @throws InvalidArgumentException When option given doesn't exist
133 public function setOption($name, $value);
136 * Returns true if an InputOption object exists by name.
138 * @param string $name The InputOption name
140 * @return bool true if the InputOption object exists, false otherwise
142 public function hasOption($name);
145 * Is this input means interactive?
149 public function isInteractive();
152 * Sets the input interactivity.
154 * @param bool $interactive If the input should be interactive
156 public function setInteractive($interactive);