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@14
|
27 * @return string|null 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@14
|
36 * Does not necessarily return the correct result for short options
|
Chris@14
|
37 * when multiple flags are combined in the same option.
|
Chris@0
|
38 *
|
Chris@0
|
39 * @param string|array $values The values to look for in the raw parameters (can be an array)
|
Chris@0
|
40 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
Chris@0
|
41 *
|
Chris@0
|
42 * @return bool true if the value is contained in the raw parameters
|
Chris@0
|
43 */
|
Chris@0
|
44 public function hasParameterOption($values, $onlyParams = false);
|
Chris@0
|
45
|
Chris@0
|
46 /**
|
Chris@0
|
47 * Returns the value of a raw option (not parsed).
|
Chris@0
|
48 *
|
Chris@0
|
49 * This method is to be used to introspect the input parameters
|
Chris@0
|
50 * before they have been validated. It must be used carefully.
|
Chris@14
|
51 * Does not necessarily return the correct result for short options
|
Chris@14
|
52 * when multiple flags are combined in the same option.
|
Chris@0
|
53 *
|
Chris@0
|
54 * @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
Chris@0
|
55 * @param mixed $default The default value to return if no result is found
|
Chris@0
|
56 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
Chris@0
|
57 *
|
Chris@0
|
58 * @return mixed The option value
|
Chris@0
|
59 */
|
Chris@0
|
60 public function getParameterOption($values, $default = false, $onlyParams = false);
|
Chris@0
|
61
|
Chris@0
|
62 /**
|
Chris@0
|
63 * Binds the current Input instance with the given arguments and options.
|
Chris@0
|
64 */
|
Chris@0
|
65 public function bind(InputDefinition $definition);
|
Chris@0
|
66
|
Chris@0
|
67 /**
|
Chris@0
|
68 * Validates the input.
|
Chris@0
|
69 *
|
Chris@0
|
70 * @throws RuntimeException When not enough arguments are given
|
Chris@0
|
71 */
|
Chris@0
|
72 public function validate();
|
Chris@0
|
73
|
Chris@0
|
74 /**
|
Chris@0
|
75 * Returns all the given arguments merged with the default values.
|
Chris@0
|
76 *
|
Chris@0
|
77 * @return array
|
Chris@0
|
78 */
|
Chris@0
|
79 public function getArguments();
|
Chris@0
|
80
|
Chris@0
|
81 /**
|
Chris@0
|
82 * Returns the argument value for a given argument name.
|
Chris@0
|
83 *
|
Chris@0
|
84 * @param string $name The argument name
|
Chris@0
|
85 *
|
Chris@0
|
86 * @return mixed The argument value
|
Chris@0
|
87 *
|
Chris@0
|
88 * @throws InvalidArgumentException When argument given doesn't exist
|
Chris@0
|
89 */
|
Chris@0
|
90 public function getArgument($name);
|
Chris@0
|
91
|
Chris@0
|
92 /**
|
Chris@0
|
93 * Sets an argument value by name.
|
Chris@0
|
94 *
|
Chris@0
|
95 * @param string $name The argument name
|
Chris@0
|
96 * @param string $value The argument value
|
Chris@0
|
97 *
|
Chris@0
|
98 * @throws InvalidArgumentException When argument given doesn't exist
|
Chris@0
|
99 */
|
Chris@0
|
100 public function setArgument($name, $value);
|
Chris@0
|
101
|
Chris@0
|
102 /**
|
Chris@0
|
103 * Returns true if an InputArgument object exists by name or position.
|
Chris@0
|
104 *
|
Chris@0
|
105 * @param string|int $name The InputArgument name or position
|
Chris@0
|
106 *
|
Chris@0
|
107 * @return bool true if the InputArgument object exists, false otherwise
|
Chris@0
|
108 */
|
Chris@0
|
109 public function hasArgument($name);
|
Chris@0
|
110
|
Chris@0
|
111 /**
|
Chris@0
|
112 * Returns all the given options merged with the default values.
|
Chris@0
|
113 *
|
Chris@0
|
114 * @return array
|
Chris@0
|
115 */
|
Chris@0
|
116 public function getOptions();
|
Chris@0
|
117
|
Chris@0
|
118 /**
|
Chris@0
|
119 * Returns the option value for a given option name.
|
Chris@0
|
120 *
|
Chris@0
|
121 * @param string $name The option name
|
Chris@0
|
122 *
|
Chris@0
|
123 * @return mixed The option value
|
Chris@0
|
124 *
|
Chris@0
|
125 * @throws InvalidArgumentException When option given doesn't exist
|
Chris@0
|
126 */
|
Chris@0
|
127 public function getOption($name);
|
Chris@0
|
128
|
Chris@0
|
129 /**
|
Chris@0
|
130 * Sets an option value by name.
|
Chris@0
|
131 *
|
Chris@0
|
132 * @param string $name The option name
|
Chris@0
|
133 * @param string|bool $value The option value
|
Chris@0
|
134 *
|
Chris@0
|
135 * @throws InvalidArgumentException When option given doesn't exist
|
Chris@0
|
136 */
|
Chris@0
|
137 public function setOption($name, $value);
|
Chris@0
|
138
|
Chris@0
|
139 /**
|
Chris@0
|
140 * Returns true if an InputOption object exists by name.
|
Chris@0
|
141 *
|
Chris@0
|
142 * @param string $name The InputOption name
|
Chris@0
|
143 *
|
Chris@0
|
144 * @return bool true if the InputOption object exists, false otherwise
|
Chris@0
|
145 */
|
Chris@0
|
146 public function hasOption($name);
|
Chris@0
|
147
|
Chris@0
|
148 /**
|
Chris@0
|
149 * Is this input means interactive?
|
Chris@0
|
150 *
|
Chris@0
|
151 * @return bool
|
Chris@0
|
152 */
|
Chris@0
|
153 public function isInteractive();
|
Chris@0
|
154
|
Chris@0
|
155 /**
|
Chris@0
|
156 * Sets the input interactivity.
|
Chris@0
|
157 *
|
Chris@0
|
158 * @param bool $interactive If the input should be interactive
|
Chris@0
|
159 */
|
Chris@0
|
160 public function setInteractive($interactive);
|
Chris@0
|
161 }
|