summaryrefslogtreecommitdiff
path: root/vendor/symfony/console/Input/InputInterface.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/console/Input/InputInterface.php')
-rw-r--r--vendor/symfony/console/Input/InputInterface.php138
1 files changed, 138 insertions, 0 deletions
diff --git a/vendor/symfony/console/Input/InputInterface.php b/vendor/symfony/console/Input/InputInterface.php
new file mode 100644
index 0000000..c177d96
--- /dev/null
+++ b/vendor/symfony/console/Input/InputInterface.php
@@ -0,0 +1,138 @@
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
12namespace Symfony\Component\Console\Input;
13
14use Symfony\Component\Console\Exception\InvalidArgumentException;
15use 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 */
22interface InputInterface
23{
24 /**
25 * Returns the first argument from the raw parameters (not parsed).
26 */
27 public function getFirstArgument(): ?string;
28
29 /**
30 * Returns true if the raw parameters (not parsed) contain a value.
31 *
32 * This method is to be used to introspect the input parameters
33 * before they have been validated. It must be used carefully.
34 * Does not necessarily return the correct result for short options
35 * when multiple flags are combined in the same option.
36 *
37 * @param string|array $values The values to look for in the raw parameters (can be an array)
38 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
39 */
40 public function hasParameterOption(string|array $values, bool $onlyParams = false): bool;
41
42 /**
43 * Returns the value of a raw option (not parsed).
44 *
45 * This method is to be used to introspect the input parameters
46 * before they have been validated. It must be used carefully.
47 * Does not necessarily return the correct result for short options
48 * when multiple flags are combined in the same option.
49 *
50 * @param string|array $values The value(s) to look for in the raw parameters (can be an array)
51 * @param string|bool|int|float|array|null $default The default value to return if no result is found
52 * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
53 */
54 public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed;
55
56 /**
57 * Binds the current Input instance with the given arguments and options.
58 *
59 * @throws RuntimeException
60 */
61 public function bind(InputDefinition $definition): void;
62
63 /**
64 * Validates the input.
65 *
66 * @throws RuntimeException When not enough arguments are given
67 */
68 public function validate(): void;
69
70 /**
71 * Returns all the given arguments merged with the default values.
72 *
73 * @return array<string|bool|int|float|array|null>
74 */
75 public function getArguments(): array;
76
77 /**
78 * Returns the argument value for a given argument name.
79 *
80 * @throws InvalidArgumentException When argument given doesn't exist
81 */
82 public function getArgument(string $name): mixed;
83
84 /**
85 * Sets an argument value by name.
86 *
87 * @throws InvalidArgumentException When argument given doesn't exist
88 */
89 public function setArgument(string $name, mixed $value): void;
90
91 /**
92 * Returns true if an InputArgument object exists by name or position.
93 */
94 public function hasArgument(string $name): bool;
95
96 /**
97 * Returns all the given options merged with the default values.
98 *
99 * @return array<string|bool|int|float|array|null>
100 */
101 public function getOptions(): array;
102
103 /**
104 * Returns the option value for a given option name.
105 *
106 * @throws InvalidArgumentException When option given doesn't exist
107 */
108 public function getOption(string $name): mixed;
109
110 /**
111 * Sets an option value by name.
112 *
113 * @throws InvalidArgumentException When option given doesn't exist
114 */
115 public function setOption(string $name, mixed $value): void;
116
117 /**
118 * Returns true if an InputOption object exists by name.
119 */
120 public function hasOption(string $name): bool;
121
122 /**
123 * Is this input means interactive?
124 */
125 public function isInteractive(): bool;
126
127 /**
128 * Sets the input interactivity.
129 */
130 public function setInteractive(bool $interactive): void;
131
132 /**
133 * Returns a stringified representation of the args passed to the command.
134 *
135 * InputArguments MUST be escaped as well as the InputOption values passed to the command.
136 */
137 public function __toString(): string;
138}