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|null 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.
36 * Does not necessarily return the correct result for short options
37 * when multiple flags are combined in the same option.
39 * @param string|array $values The values to look for in the raw parameters (can be an array)
40 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
42 * @return bool true if the value is contained in the raw parameters
44 public function hasParameterOption($values, $onlyParams = false);
47 * Returns the value of a raw option (not parsed).
49 * This method is to be used to introspect the input parameters
50 * before they have been validated. It must be used carefully.
51 * Does not necessarily return the correct result for short options
52 * when multiple flags are combined in the same option.
54 * @param string|array $values The value(s) to look for in the raw parameters (can be an array)
55 * @param mixed $default The default value to return if no result is found
56 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
58 * @return mixed The option value
60 public function getParameterOption($values, $default = false, $onlyParams = false);
63 * Binds the current Input instance with the given arguments and options.
65 public function bind(InputDefinition $definition);
68 * Validates the input.
70 * @throws RuntimeException When not enough arguments are given
72 public function validate();
75 * Returns all the given arguments merged with the default values.
79 public function getArguments();
82 * Returns the argument value for a given argument name.
84 * @param string $name The argument name
86 * @return mixed The argument value
88 * @throws InvalidArgumentException When argument given doesn't exist
90 public function getArgument($name);
93 * Sets an argument value by name.
95 * @param string $name The argument name
96 * @param string $value The argument value
98 * @throws InvalidArgumentException When argument given doesn't exist
100 public function setArgument($name, $value);
103 * Returns true if an InputArgument object exists by name or position.
105 * @param string|int $name The InputArgument name or position
107 * @return bool true if the InputArgument object exists, false otherwise
109 public function hasArgument($name);
112 * Returns all the given options merged with the default values.
116 public function getOptions();
119 * Returns the option value for a given option name.
121 * @param string $name The option name
123 * @return mixed The option value
125 * @throws InvalidArgumentException When option given doesn't exist
127 public function getOption($name);
130 * Sets an option value by name.
132 * @param string $name The option name
133 * @param string|bool $value The option value
135 * @throws InvalidArgumentException When option given doesn't exist
137 public function setOption($name, $value);
140 * Returns true if an InputOption object exists by name.
142 * @param string $name The InputOption name
144 * @return bool true if the InputOption object exists, false otherwise
146 public function hasOption($name);
149 * Is this input means interactive?
153 public function isInteractive();
156 * Sets the input interactivity.
158 * @param bool $interactive If the input should be interactive
160 public function setInteractive($interactive);