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