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;
15 * InputInterface is the interface implemented by all input classes.
17 * @author Fabien Potencier <fabien@symfony.com>
19 interface InputInterface
22 * Returns the first argument from the raw parameters (not parsed).
24 * @return string The value of the first argument or null otherwise
26 public function getFirstArgument();
29 * Returns true if the raw parameters (not parsed) contain a value.
31 * This method is to be used to introspect the input parameters
32 * before they have been validated. It must be used carefully.
34 * @param string|array $values The values to look for in the raw parameters (can be an array)
36 * @return Boolean true if the value is contained in the raw parameters
38 public function hasParameterOption($values);
41 * Returns the value of a raw option (not parsed).
43 * This method is to be used to introspect the input parameters
44 * before they have been validated. It must be used carefully.
46 * @param string|array $values The value(s) to look for in the raw parameters (can be an array)
47 * @param mixed $default The default value to return if no result is found
49 * @return mixed The option value
51 public function getParameterOption($values, $default = false);
54 * Binds the current Input instance with the given arguments and options.
56 * @param InputDefinition $definition A InputDefinition instance
58 public function bind(InputDefinition $definition);
61 * Validates if arguments given are correct.
63 * Throws an exception when not enough arguments are given.
65 * @throws \RuntimeException
67 public function validate();
70 * Returns all the given arguments merged with the default values.
74 public function getArguments();
77 * Gets argument by name.
79 * @param string $name The name of the argument
83 public function getArgument($name);
86 * Sets an argument value by name.
88 * @param string $name The argument name
89 * @param string $value The argument value
91 * @throws \InvalidArgumentException When argument given doesn't exist
93 public function setArgument($name, $value);
96 * Returns true if an InputArgument object exists by name or position.
98 * @param string|integer $name The InputArgument name or position
100 * @return Boolean true if the InputArgument object exists, false otherwise
102 public function hasArgument($name);
105 * Returns all the given options merged with the default values.
109 public function getOptions();
112 * Gets an option by name.
114 * @param string $name The name of the option
118 public function getOption($name);
121 * Sets an option value by name.
123 * @param string $name The option name
124 * @param string $value The option value
126 * @throws \InvalidArgumentException When option given doesn't exist
128 public function setOption($name, $value);
131 * Returns true if an InputOption object exists by name.
133 * @param string $name The InputOption name
135 * @return Boolean true if the InputOption object exists, false otherwise
137 public function hasOption($name);
140 * Is this input means interactive?
144 public function isInteractive();
147 * Sets the input interactivity.
149 * @param Boolean $interactive If the input should be interactive
151 public function setInteractive($interactive);