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: public function getFirstArgument();
27:
28: /**
29: * Returns true if the raw parameters (not parsed) contain a value.
30: *
31: * This method is to be used to introspect the input parameters
32: * before they have 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: public 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 they have 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: public 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: public function bind(InputDefinition $definition);
59:
60: /**
61: * Validates if arguments given are correct.
62: *
63: * Throws an exception when not enough arguments are given.
64: *
65: * @throws \RuntimeException
66: */
67: public function validate();
68:
69: /**
70: * Returns all the given arguments merged with the default values.
71: *
72: * @return array
73: */
74: public function getArguments();
75:
76: /**
77: * Gets argument by name.
78: *
79: * @param string $name The name of the argument
80: *
81: * @return mixed
82: */
83: public function getArgument($name);
84:
85: /**
86: * Sets an argument value by name.
87: *
88: * @param string $name The argument name
89: * @param string $value The argument value
90: *
91: * @throws \InvalidArgumentException When argument given doesn't exist
92: */
93: public function setArgument($name, $value);
94:
95: /**
96: * Returns true if an InputArgument object exists by name or position.
97: *
98: * @param string|integer $name The InputArgument name or position
99: *
100: * @return Boolean true if the InputArgument object exists, false otherwise
101: */
102: public function hasArgument($name);
103:
104: /**
105: * Returns all the given options merged with the default values.
106: *
107: * @return array
108: */
109: public function getOptions();
110:
111: /**
112: * Gets an option by name.
113: *
114: * @param string $name The name of the option
115: *
116: * @return mixed
117: */
118: public function getOption($name);
119:
120: /**
121: * Sets an option value by name.
122: *
123: * @param string $name The option name
124: * @param string $value The option value
125: *
126: * @throws \InvalidArgumentException When option given doesn't exist
127: */
128: public function setOption($name, $value);
129:
130: /**
131: * Returns true if an InputOption object exists by name.
132: *
133: * @param string $name The InputOption name
134: *
135: * @return Boolean true if the InputOption object exists, false otherwise
136: */
137: public function hasOption($name);
138:
139: /**
140: * Is this input means interactive?
141: *
142: * @return Boolean
143: */
144: public function isInteractive();
145:
146: /**
147: * Sets the input interactivity.
148: *
149: * @param Boolean $interactive If the input should be interactive
150: */
151: public function setInteractive($interactive);
152: }
153: