| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of the Symfony package. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier <fabien@symfony.com> |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace Symfony\Component\Console\Input; |
| 13 |
|
| 14 |
use Symfony\Component\Console\Exception\InvalidArgumentException; |
| 15 |
use Symfony\Component\Console\Exception\RuntimeException; |
| 16 |
|
| 17 |
/** |
| 18 |
* InputInterface is the interface implemented by all input classes. |
| 19 |
* |
| 20 |
* @author Fabien Potencier <fabien@symfony.com> |
| 21 |
*/ |
| 22 |
interface InputInterface |
| 23 |
{ |
| 24 |
/** |
| 25 |
* Returns the first argument from the raw parameters (not parsed). |
| 26 |
* |
| 27 |
* @return string|null The value of the first argument or null otherwise |
| 28 |
*/ |
| 29 |
public function getFirstArgument(); |
| 30 |
|
| 31 |
/** |
| 32 |
* Returns true if the raw parameters (not parsed) contain a value. |
| 33 |
* |
| 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. |
| 38 |
* |
| 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 |
| 41 |
* |
| 42 |
* @return bool true if the value is contained in the raw parameters |
| 43 |
*/ |
| 44 |
public function hasParameterOption($values, bool $onlyParams = false); |
| 45 |
|
| 46 |
/** |
| 47 |
* Returns the value of a raw option (not parsed). |
| 48 |
* |
| 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. |
| 53 |
* |
| 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 |
| 57 |
* |
| 58 |
* @return mixed The option value |
| 59 |
*/ |
| 60 |
public function getParameterOption($values, $default = false, bool $onlyParams = false); |
| 61 |
|
| 62 |
/** |
| 63 |
* Binds the current Input instance with the given arguments and options. |
| 64 |
* |
| 65 |
* @throws RuntimeException |
| 66 |
*/ |
| 67 |
public function bind(InputDefinition $definition); |
| 68 |
|
| 69 |
/** |
| 70 |
* Validates the input. |
| 71 |
* |
| 72 |
* @throws RuntimeException When not enough arguments are given |
| 73 |
*/ |
| 74 |
public function validate(); |
| 75 |
|
| 76 |
/** |
| 77 |
* Returns all the given arguments merged with the default values. |
| 78 |
* |
| 79 |
* @return array |
| 80 |
*/ |
| 81 |
public function getArguments(); |
| 82 |
|
| 83 |
/** |
| 84 |
* Returns the argument value for a given argument name. |
| 85 |
* |
| 86 |
* @return string|string[]|null The argument value |
| 87 |
* |
| 88 |
* @throws InvalidArgumentException When argument given doesn't exist |
| 89 |
*/ |
| 90 |
public function getArgument(string $name); |
| 91 |
|
| 92 |
/** |
| 93 |
* Sets an argument value by name. |
| 94 |
* |
| 95 |
* @param string|string[]|null $value The argument value |
| 96 |
* |
| 97 |
* @throws InvalidArgumentException When argument given doesn't exist |
| 98 |
*/ |
| 99 |
public function setArgument(string $name, $value); |
| 100 |
|
| 101 |
/** |
| 102 |
* Returns true if an InputArgument object exists by name or position. |
| 103 |
* |
| 104 |
* @param string|int $name The InputArgument name or position |
| 105 |
* |
| 106 |
* @return bool true if the InputArgument object exists, false otherwise |
| 107 |
*/ |
| 108 |
public function hasArgument($name); |
| 109 |
|
| 110 |
/** |
| 111 |
* Returns all the given options merged with the default values. |
| 112 |
* |
| 113 |
* @return array |
| 114 |
*/ |
| 115 |
public function getOptions(); |
| 116 |
|
| 117 |
/** |
| 118 |
* Returns the option value for a given option name. |
| 119 |
* |
| 120 |
* @return string|string[]|bool|null The option value |
| 121 |
* |
| 122 |
* @throws InvalidArgumentException When option given doesn't exist |
| 123 |
*/ |
| 124 |
public function getOption(string $name); |
| 125 |
|
| 126 |
/** |
| 127 |
* Sets an option value by name. |
| 128 |
* |
| 129 |
* @param string|string[]|bool|null $value The option value |
| 130 |
* |
| 131 |
* @throws InvalidArgumentException When option given doesn't exist |
| 132 |
*/ |
| 133 |
public function setOption(string $name, $value); |
| 134 |
|
| 135 |
/** |
| 136 |
* Returns true if an InputOption object exists by name. |
| 137 |
* |
| 138 |
* @return bool true if the InputOption object exists, false otherwise |
| 139 |
*/ |
| 140 |
public function hasOption(string $name); |
| 141 |
|
| 142 |
/** |
| 143 |
* Is this input means interactive? |
| 144 |
* |
| 145 |
* @return bool |
| 146 |
*/ |
| 147 |
public function isInteractive(); |
| 148 |
|
| 149 |
/** |
| 150 |
* Sets the input interactivity. |
| 151 |
*/ |
| 152 |
public function setInteractive(bool $interactive); |
| 153 |
} |
| 154 |
|