Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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