|
0
|
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 |
/** |
|
|
15 |
* InputInterface is the interface implemented by all input classes. |
|
|
16 |
* |
|
|
17 |
* @author Fabien Potencier <fabien@symfony.com> |
|
|
18 |
*/ |
|
|
19 |
interface InputInterface |
|
|
20 |
{ |
|
|
21 |
/** |
|
|
22 |
* Returns the first argument from the raw parameters (not parsed). |
|
|
23 |
* |
|
|
24 |
* @return string The value of the first argument or null otherwise |
|
|
25 |
*/ |
|
|
26 |
function getFirstArgument(); |
|
|
27 |
|
|
|
28 |
/** |
|
|
29 |
* Returns true if the raw parameters (not parsed) contains a value. |
|
|
30 |
* |
|
|
31 |
* This method is to be used to introspect the input parameters |
|
|
32 |
* before it has been validated. It must be used carefully. |
|
|
33 |
* |
|
|
34 |
* @param string|array $values The values to look for in the raw parameters (can be an array) |
|
|
35 |
* |
|
|
36 |
* @return Boolean true if the value is contained in the raw parameters |
|
|
37 |
*/ |
|
|
38 |
function hasParameterOption($values); |
|
|
39 |
|
|
|
40 |
/** |
|
|
41 |
* Returns the value of a raw option (not parsed). |
|
|
42 |
* |
|
|
43 |
* This method is to be used to introspect the input parameters |
|
|
44 |
* before it has been validated. It must be used carefully. |
|
|
45 |
* |
|
|
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 |
|
|
48 |
* |
|
|
49 |
* @return mixed The option value |
|
|
50 |
*/ |
|
|
51 |
function getParameterOption($values, $default = false); |
|
|
52 |
|
|
|
53 |
/** |
|
|
54 |
* Binds the current Input instance with the given arguments and options. |
|
|
55 |
* |
|
|
56 |
* @param InputDefinition $definition A InputDefinition instance |
|
|
57 |
*/ |
|
|
58 |
function bind(InputDefinition $definition); |
|
|
59 |
|
|
|
60 |
/** |
|
|
61 |
* Validate if arguments given are correct. |
|
|
62 |
* |
|
|
63 |
* Throws an exception when not enough arguments are given. |
|
|
64 |
* |
|
|
65 |
* @throws \RuntimeException |
|
|
66 |
*/ |
|
|
67 |
function validate(); |
|
|
68 |
|
|
|
69 |
/** |
|
|
70 |
* Returns all the given arguments merged with the default values. |
|
|
71 |
* |
|
|
72 |
* @return array |
|
|
73 |
*/ |
|
|
74 |
function getArguments(); |
|
|
75 |
|
|
|
76 |
/** |
|
|
77 |
* Get argument by name. |
|
|
78 |
* |
|
|
79 |
* @param string $name The name of the argument |
|
|
80 |
* @return mixed |
|
|
81 |
*/ |
|
|
82 |
function getArgument($name); |
|
|
83 |
|
|
|
84 |
/** |
|
|
85 |
* @return array |
|
|
86 |
*/ |
|
|
87 |
function getOptions(); |
|
|
88 |
|
|
|
89 |
/** |
|
|
90 |
* Get an option by name. |
|
|
91 |
* |
|
|
92 |
* @param string $name The name of the option |
|
|
93 |
* @return mixed |
|
|
94 |
*/ |
|
|
95 |
function getOption($name); |
|
|
96 |
|
|
|
97 |
/** |
|
|
98 |
* Is this input means interactive? |
|
|
99 |
* |
|
|
100 |
* @return Boolean |
|
|
101 |
*/ |
|
|
102 |
function isInteractive(); |
|
|
103 |
} |