MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Input.php
Ir para a documentação deste ficheiro.
1
<?php
2
3
namespace
Symfony\Component\Console\Input
;
4
5
/*
6
* This file is part of the Symfony framework.
7
*
8
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
9
*
10
* This source file is subject to the MIT license that is bundled
11
* with this source code in the file LICENSE.
12
*/
13
25
abstract
class
Input
implements
InputInterface
26
{
27
protected
$definition
;
28
protected
$options
;
29
protected
$arguments
;
30
protected
$interactive
=
true
;
31
37
public
function
__construct
(
InputDefinition
$definition
=
null
)
38
{
39
if
(
null
===
$definition
) {
40
$this->definition =
new
InputDefinition
();
41
}
else
{
42
$this->
bind
(
$definition
);
43
$this->
validate
();
44
}
45
}
46
52
public
function
bind
(
InputDefinition
$definition
)
53
{
54
$this->arguments = array();
55
$this->options = array();
56
$this->definition =
$definition
;
57
58
$this->
parse
();
59
}
60
64
abstract
protected
function
parse
();
65
69
public
function
validate
()
70
{
71
if
(count($this->arguments) < $this->definition->getArgumentRequiredCount()) {
72
throw
new \RuntimeException(
'Not enough arguments.'
);
73
}
74
}
75
76
public
function
isInteractive
()
77
{
78
return
$this->interactive
;
79
}
80
81
public
function
setInteractive
(
$interactive
)
82
{
83
$this->interactive = (Boolean)
$interactive
;
84
}
85
91
public
function
getArguments
()
92
{
93
return
array_merge($this->definition->getArgumentDefaults(), $this->arguments);
94
}
95
105
public
function
getArgument
($name)
106
{
107
if
(!$this->definition->hasArgument($name)) {
108
throw
new \InvalidArgumentException(sprintf(
'The "%s" argument does not exist.'
, $name));
109
}
110
111
return
isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
112
}
113
122
public
function
setArgument
($name, $value)
123
{
124
if
(!$this->definition->hasArgument($name)) {
125
throw
new \InvalidArgumentException(sprintf(
'The "%s" argument does not exist.'
, $name));
126
}
127
128
$this->arguments[$name] = $value;
129
}
130
138
public
function
hasArgument
($name)
139
{
140
return
$this->definition->hasArgument($name);
141
}
142
148
public
function
getOptions
()
149
{
150
return
array_merge($this->definition->getOptionDefaults(), $this->options);
151
}
152
162
public
function
getOption
($name)
163
{
164
if
(!$this->definition->hasOption($name)) {
165
throw
new \InvalidArgumentException(sprintf(
'The "%s" option does not exist.'
, $name));
166
}
167
168
return
isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
169
}
170
179
public
function
setOption
($name, $value)
180
{
181
if
(!$this->definition->hasOption($name)) {
182
throw
new \InvalidArgumentException(sprintf(
'The "%s" option does not exist.'
, $name));
183
}
184
185
$this->options[$name] = $value;
186
}
187
195
public
function
hasOption
($name)
196
{
197
return
$this->definition->hasOption($name);
198
}
199
}
Symfony\Component\Console\Input\InputDefinition
Definição
InputDefinition.php:27
Symfony\Component\Console\Input\Input
Definição
Input.php:26
Symfony\Component\Console\Input\Input\$options
$options
Definição
Input.php:28
Symfony\Component\Console\Input\Input\hasArgument
hasArgument($name)
Definição
Input.php:138
Symfony\Component\Console\Input\Input\$definition
$definition
Definição
Input.php:27
Symfony\Component\Console\Input\Input\validate
validate()
Definição
Input.php:69
Symfony\Component\Console\Input\Input\getOptions
getOptions()
Definição
Input.php:148
Symfony\Component\Console\Input\Input\getArguments
getArguments()
Definição
Input.php:91
Symfony\Component\Console\Input\Input\setArgument
setArgument($name, $value)
Definição
Input.php:122
Symfony\Component\Console\Input\Input\parse
parse()
Symfony\Component\Console\Input\Input\$interactive
$interactive
Definição
Input.php:30
Symfony\Component\Console\Input\Input\$arguments
$arguments
Definição
Input.php:29
Symfony\Component\Console\Input\Input\setOption
setOption($name, $value)
Definição
Input.php:179
Symfony\Component\Console\Input\Input\isInteractive
isInteractive()
Definição
Input.php:76
Symfony\Component\Console\Input\Input\getOption
getOption($name)
Definição
Input.php:162
Symfony\Component\Console\Input\Input\hasOption
hasOption($name)
Definição
Input.php:195
Symfony\Component\Console\Input\Input\getArgument
getArgument($name)
Definição
Input.php:105
Symfony\Component\Console\Input\Input\__construct
__construct(InputDefinition $definition=null)
Definição
Input.php:37
Symfony\Component\Console\Input\Input\bind
bind(InputDefinition $definition)
Definição
Input.php:52
Symfony\Component\Console\Input\Input\setInteractive
setInteractive($interactive)
Definição
Input.php:81
Symfony\Component\Console\Input\InputInterface
Definição
InputInterface.php:20
Symfony\Component\Console\Input
Definição
ArgvInput.php:3
classes
extensions
doctrine-dbal
Doctrine
Symfony
Component
Console
Input
Input.php
Gerado por
1.10.0