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)
38 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
40 * @return bool true if the value is contained in the raw parameters
42 public function hasParameterOption($values, $onlyParams = false);
45 * Returns the value of a raw option (not parsed).
47 * This method is to be used to introspect the input parameters
48 * before they have been validated. It must be used carefully.
50 * @param string|array $values The value(s) to look for in the raw parameters (can be an array)
51 * @param mixed $default The default value to return if no result is found
52 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
54 * @return mixed The option value
56 public function getParameterOption($values, $default = false, $onlyParams = false);
59 * Binds the current Input instance with the given arguments and options.
61 * @param InputDefinition $definition A InputDefinition instance
63 public function bind(InputDefinition $definition);
66 * Validates the input.
68 * @throws RuntimeException When not enough arguments are given
70 public function validate();
73 * Returns all the given arguments merged with the default values.
77 public function getArguments();
80 * Returns the argument value for a given argument name.
82 * @param string $name The argument name
84 * @return mixed The argument value
86 * @throws InvalidArgumentException When argument given doesn't exist
88 public function getArgument($name);
91 * Sets an argument value by name.
93 * @param string $name The argument name
94 * @param string $value The argument value
96 * @throws InvalidArgumentException When argument given doesn't exist
98 public function setArgument($name, $value);
101 * Returns true if an InputArgument object exists by name or position.
103 * @param string|int $name The InputArgument name or position
105 * @return bool true if the InputArgument object exists, false otherwise
107 public function hasArgument($name);
110 * Returns all the given options merged with the default values.
114 public function getOptions();
117 * Returns the option value for a given option name.
119 * @param string $name The option name
121 * @return mixed The option value
123 * @throws InvalidArgumentException When option given doesn't exist
125 public function getOption($name);
128 * Sets an option value by name.
130 * @param string $name The option name
131 * @param string|bool $value The option value
133 * @throws InvalidArgumentException When option given doesn't exist
135 public function setOption($name, $value);
138 * Returns true if an InputOption object exists by name.
140 * @param string $name The InputOption name
142 * @return bool true if the InputOption object exists, false otherwise
144 public function hasOption($name);
147 * Is this input means interactive?
151 public function isInteractive();
154 * Sets the input interactivity.
156 * @param bool $interactive If the input should be interactive
158 public function setInteractive($interactive);