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