Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
3231fbd3
Commit
3231fbd3
authored
Nov 28, 2010
by
Fabien Potencier
Committed by
Benjamin Eberlei
Nov 30, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Symfony\Component\Console to latest version
parent
5cd66217
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
69 deletions
+69
-69
RunSqlCommand.php
lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php
+1
-1
Application.php
lib/vendor/Symfony/Component/Console/Application.php
+23
-23
Command.php
lib/vendor/Symfony/Component/Console/Command/Command.php
+2
-2
HelpCommand.php
lib/vendor/Symfony/Component/Console/Command/HelpCommand.php
+2
-2
ListCommand.php
lib/vendor/Symfony/Component/Console/Command/ListCommand.php
+1
-1
ArgvInput.php
lib/vendor/Symfony/Component/Console/Input/ArgvInput.php
+5
-5
ArrayInput.php
lib/vendor/Symfony/Component/Console/Input/ArrayInput.php
+2
-2
InputDefinition.php
...endor/Symfony/Component/Console/Input/InputDefinition.php
+6
-6
InputOption.php
lib/vendor/Symfony/Component/Console/Input/InputOption.php
+26
-26
Shell.php
lib/vendor/Symfony/Component/Console/Shell.php
+1
-1
No files found.
lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php
View file @
3231fbd3
...
@@ -50,7 +50,7 @@ class RunSqlCommand extends Console\Command\Command
...
@@ -50,7 +50,7 @@ class RunSqlCommand extends Console\Command\Command
->
setDescription
(
'Executes arbitrary SQL directly from the command line.'
)
->
setDescription
(
'Executes arbitrary SQL directly from the command line.'
)
->
setDefinition
(
array
(
->
setDefinition
(
array
(
new
InputArgument
(
'sql'
,
InputArgument
::
REQUIRED
,
'The SQL statement to execute.'
),
new
InputArgument
(
'sql'
,
InputArgument
::
REQUIRED
,
'The SQL statement to execute.'
),
new
InputOption
(
'depth'
,
null
,
InputOption
::
PARAMETER
_REQUIRED
,
'Dumping depth of result set.'
,
7
)
new
InputOption
(
'depth'
,
null
,
InputOption
::
VALUE
_REQUIRED
,
'Dumping depth of result set.'
,
7
)
))
))
->
setHelp
(
<<<EOT
->
setHelp
(
<<<EOT
Executes arbitrary SQL directly from the command line.
Executes arbitrary SQL directly from the command line.
...
...
lib/vendor/Symfony/Component/Console/Application.php
View file @
3231fbd3
...
@@ -37,7 +37,7 @@ use Symfony\Component\Console\Helper\DialogHelper;
...
@@ -37,7 +37,7 @@ use Symfony\Component\Console\Helper\DialogHelper;
* Usage:
* Usage:
*
*
* $app = new Application('myapp', '1.0 (stable)');
* $app = new Application('myapp', '1.0 (stable)');
* $app->add
Command
(new SimpleCommand());
* $app->add(new SimpleCommand());
* $app->run();
* $app->run();
*
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
...
@@ -74,18 +74,18 @@ class Application
...
@@ -74,18 +74,18 @@ class Application
new
DialogHelper
(),
new
DialogHelper
(),
));
));
$this
->
add
Command
(
new
HelpCommand
());
$this
->
add
(
new
HelpCommand
());
$this
->
add
Command
(
new
ListCommand
());
$this
->
add
(
new
ListCommand
());
$this
->
definition
=
new
InputDefinition
(
array
(
$this
->
definition
=
new
InputDefinition
(
array
(
new
InputArgument
(
'command'
,
InputArgument
::
REQUIRED
,
'The command to execute'
),
new
InputArgument
(
'command'
,
InputArgument
::
REQUIRED
,
'The command to execute'
),
new
InputOption
(
'--help'
,
'-h'
,
InputOption
::
PARAMETER
_NONE
,
'Display this help message.'
),
new
InputOption
(
'--help'
,
'-h'
,
InputOption
::
VALUE
_NONE
,
'Display this help message.'
),
new
InputOption
(
'--quiet'
,
'-q'
,
InputOption
::
PARAMETER
_NONE
,
'Do not output any message.'
),
new
InputOption
(
'--quiet'
,
'-q'
,
InputOption
::
VALUE
_NONE
,
'Do not output any message.'
),
new
InputOption
(
'--verbose'
,
'-v'
,
InputOption
::
PARAMETER
_NONE
,
'Increase verbosity of messages.'
),
new
InputOption
(
'--verbose'
,
'-v'
,
InputOption
::
VALUE
_NONE
,
'Increase verbosity of messages.'
),
new
InputOption
(
'--version'
,
'-V'
,
InputOption
::
PARAMETER
_NONE
,
'Display this program version.'
),
new
InputOption
(
'--version'
,
'-V'
,
InputOption
::
VALUE
_NONE
,
'Display this program version.'
),
new
InputOption
(
'--ansi'
,
'-a'
,
InputOption
::
PARAMETER
_NONE
,
'Force ANSI output.'
),
new
InputOption
(
'--ansi'
,
'-a'
,
InputOption
::
VALUE
_NONE
,
'Force ANSI output.'
),
new
InputOption
(
'--no-interaction'
,
'-n'
,
InputOption
::
PARAMETER
_NONE
,
'Do not ask any interactive question.'
),
new
InputOption
(
'--no-interaction'
,
'-n'
,
InputOption
::
VALUE
_NONE
,
'Do not ask any interactive question.'
),
));
));
}
}
...
@@ -181,7 +181,7 @@ class Application
...
@@ -181,7 +181,7 @@ class Application
}
}
// the command name MUST be the first element of the input
// the command name MUST be the first element of the input
$command
=
$this
->
find
Command
(
$name
);
$command
=
$this
->
find
(
$name
);
$this
->
runningCommand
=
$command
;
$this
->
runningCommand
=
$command
;
$statusCode
=
$command
->
run
(
$input
,
$output
);
$statusCode
=
$command
->
run
(
$input
,
$output
);
...
@@ -329,7 +329,7 @@ class Application
...
@@ -329,7 +329,7 @@ class Application
*/
*/
public
function
register
(
$name
)
public
function
register
(
$name
)
{
{
return
$this
->
add
Command
(
new
Command
(
$name
));
return
$this
->
add
(
new
Command
(
$name
));
}
}
/**
/**
...
@@ -340,7 +340,7 @@ class Application
...
@@ -340,7 +340,7 @@ class Application
public
function
addCommands
(
array
$commands
)
public
function
addCommands
(
array
$commands
)
{
{
foreach
(
$commands
as
$command
)
{
foreach
(
$commands
as
$command
)
{
$this
->
add
Command
(
$command
);
$this
->
add
(
$command
);
}
}
}
}
...
@@ -353,7 +353,7 @@ class Application
...
@@ -353,7 +353,7 @@ class Application
*
*
* @return Command The registered command
* @return Command The registered command
*/
*/
public
function
add
Command
(
Command
$command
)
public
function
add
(
Command
$command
)
{
{
$command
->
setApplication
(
$this
);
$command
->
setApplication
(
$this
);
...
@@ -375,7 +375,7 @@ class Application
...
@@ -375,7 +375,7 @@ class Application
*
*
* @throws \InvalidArgumentException When command name given does not exist
* @throws \InvalidArgumentException When command name given does not exist
*/
*/
public
function
get
Command
(
$name
)
public
function
get
(
$name
)
{
{
if
(
!
isset
(
$this
->
commands
[
$name
])
&&
!
isset
(
$this
->
aliases
[
$name
]))
{
if
(
!
isset
(
$this
->
commands
[
$name
])
&&
!
isset
(
$this
->
aliases
[
$name
]))
{
throw
new
\InvalidArgumentException
(
sprintf
(
'The command "%s" does not exist.'
,
$name
));
throw
new
\InvalidArgumentException
(
sprintf
(
'The command "%s" does not exist.'
,
$name
));
...
@@ -386,7 +386,7 @@ class Application
...
@@ -386,7 +386,7 @@ class Application
if
(
$this
->
wantHelps
)
{
if
(
$this
->
wantHelps
)
{
$this
->
wantHelps
=
false
;
$this
->
wantHelps
=
false
;
$helpCommand
=
$this
->
get
Command
(
'help'
);
$helpCommand
=
$this
->
get
(
'help'
);
$helpCommand
->
setCommand
(
$command
);
$helpCommand
->
setCommand
(
$command
);
return
$helpCommand
;
return
$helpCommand
;
...
@@ -402,7 +402,7 @@ class Application
...
@@ -402,7 +402,7 @@ class Application
*
*
* @return Boolean true if the command exists, false otherwise
* @return Boolean true if the command exists, false otherwise
*/
*/
public
function
has
Command
(
$name
)
public
function
has
(
$name
)
{
{
return
isset
(
$this
->
commands
[
$name
])
||
isset
(
$this
->
aliases
[
$name
]);
return
isset
(
$this
->
commands
[
$name
])
||
isset
(
$this
->
aliases
[
$name
]);
}
}
...
@@ -451,7 +451,7 @@ class Application
...
@@ -451,7 +451,7 @@ class Application
/**
/**
* Finds a command by name or alias.
* Finds a command by name or alias.
*
*
* Contrary to get
Command
, this command tries to find the best
* Contrary to get, this command tries to find the best
* match if you give it an abbreviation of a name or alias.
* match if you give it an abbreviation of a name or alias.
*
*
* @param string $name A command name or a command alias
* @param string $name A command name or a command alias
...
@@ -460,7 +460,7 @@ class Application
...
@@ -460,7 +460,7 @@ class Application
*
*
* @throws \InvalidArgumentException When command name is incorrect or ambiguous
* @throws \InvalidArgumentException When command name is incorrect or ambiguous
*/
*/
public
function
find
Command
(
$name
)
public
function
find
(
$name
)
{
{
// namespace
// namespace
$namespace
=
''
;
$namespace
=
''
;
...
@@ -481,7 +481,7 @@ class Application
...
@@ -481,7 +481,7 @@ class Application
$abbrevs
=
static
::
getAbbreviations
(
$commands
);
$abbrevs
=
static
::
getAbbreviations
(
$commands
);
if
(
isset
(
$abbrevs
[
$name
])
&&
1
==
count
(
$abbrevs
[
$name
]))
{
if
(
isset
(
$abbrevs
[
$name
])
&&
1
==
count
(
$abbrevs
[
$name
]))
{
return
$this
->
get
Command
(
$namespace
?
$namespace
.
':'
.
$abbrevs
[
$name
][
0
]
:
$abbrevs
[
$name
][
0
]);
return
$this
->
get
(
$namespace
?
$namespace
.
':'
.
$abbrevs
[
$name
][
0
]
:
$abbrevs
[
$name
][
0
]);
}
}
if
(
isset
(
$abbrevs
[
$name
])
&&
count
(
$abbrevs
[
$name
])
>
1
)
{
if
(
isset
(
$abbrevs
[
$name
])
&&
count
(
$abbrevs
[
$name
])
>
1
)
{
...
@@ -500,7 +500,7 @@ class Application
...
@@ -500,7 +500,7 @@ class Application
throw
new
\InvalidArgumentException
(
sprintf
(
'Command "%s" is ambiguous (%s).'
,
$fullName
,
$this
->
getAbbreviationSuggestions
(
$abbrevs
[
$fullName
])));
throw
new
\InvalidArgumentException
(
sprintf
(
'Command "%s" is ambiguous (%s).'
,
$fullName
,
$this
->
getAbbreviationSuggestions
(
$abbrevs
[
$fullName
])));
}
}
return
$this
->
get
Command
(
$abbrevs
[
$fullName
][
0
]);
return
$this
->
get
(
$abbrevs
[
$fullName
][
0
]);
}
}
/**
/**
...
@@ -512,7 +512,7 @@ class Application
...
@@ -512,7 +512,7 @@ class Application
*
*
* @return array An array of Command instances
* @return array An array of Command instances
*/
*/
public
function
getCommands
(
$namespace
=
null
)
public
function
all
(
$namespace
=
null
)
{
{
if
(
null
===
$namespace
)
{
if
(
null
===
$namespace
)
{
return
$this
->
commands
;
return
$this
->
commands
;
...
@@ -566,7 +566,7 @@ class Application
...
@@ -566,7 +566,7 @@ class Application
*/
*/
public
function
asText
(
$namespace
=
null
)
public
function
asText
(
$namespace
=
null
)
{
{
$commands
=
$namespace
?
$this
->
getCommands
(
$this
->
findNamespace
(
$namespace
))
:
$this
->
commands
;
$commands
=
$namespace
?
$this
->
all
(
$this
->
findNamespace
(
$namespace
))
:
$this
->
commands
;
$messages
=
array
(
$this
->
getHelp
(),
''
);
$messages
=
array
(
$this
->
getHelp
(),
''
);
if
(
$namespace
)
{
if
(
$namespace
)
{
...
@@ -607,7 +607,7 @@ class Application
...
@@ -607,7 +607,7 @@ class Application
*/
*/
public
function
asXml
(
$namespace
=
null
,
$asDom
=
false
)
public
function
asXml
(
$namespace
=
null
,
$asDom
=
false
)
{
{
$commands
=
$namespace
?
$this
->
getCommands
(
$this
->
findNamespace
(
$namespace
))
:
$this
->
commands
;
$commands
=
$namespace
?
$this
->
all
(
$this
->
findNamespace
(
$namespace
))
:
$this
->
commands
;
$dom
=
new
\DOMDocument
(
'1.0'
,
'UTF-8'
);
$dom
=
new
\DOMDocument
(
'1.0'
,
'UTF-8'
);
$dom
->
formatOutput
=
true
;
$dom
->
formatOutput
=
true
;
...
...
lib/vendor/Symfony/Component/Console/Command/Command.php
View file @
3231fbd3
...
@@ -236,9 +236,9 @@ class Command
...
@@ -236,9 +236,9 @@ class Command
*
*
* @param string $name The option name
* @param string $name The option name
* @param string $shortcut The shortcut (can be null)
* @param string $shortcut The shortcut (can be null)
* @param integer $mode The option mode:
self::PARAMETER_REQUIRED, self::PARAMETER_NONE or self::PARAMETER_OPTIONAL
* @param integer $mode The option mode:
One of the InputOption::VALUE_* constants
* @param string $description A description text
* @param string $description A description text
* @param mixed $default The default value (must be null for
self::PARAMETER_REQUIRED or self::PARAMETER
_NONE)
* @param mixed $default The default value (must be null for
InputOption::VALUE_REQUIRED or self::VALUE
_NONE)
*
*
* @return Command The current instance
* @return Command The current instance
*/
*/
...
...
lib/vendor/Symfony/Component/Console/Command/HelpCommand.php
View file @
3231fbd3
...
@@ -37,7 +37,7 @@ class HelpCommand extends Command
...
@@ -37,7 +37,7 @@ class HelpCommand extends Command
$this
$this
->
setDefinition
(
array
(
->
setDefinition
(
array
(
new
InputArgument
(
'command_name'
,
InputArgument
::
OPTIONAL
,
'The command name'
,
'help'
),
new
InputArgument
(
'command_name'
,
InputArgument
::
OPTIONAL
,
'The command name'
,
'help'
),
new
InputOption
(
'xml'
,
null
,
InputOption
::
PARAMETER
_NONE
,
'To output help as XML'
),
new
InputOption
(
'xml'
,
null
,
InputOption
::
VALUE
_NONE
,
'To output help as XML'
),
))
))
->
setName
(
'help'
)
->
setName
(
'help'
)
->
setAliases
(
array
(
'?'
))
->
setAliases
(
array
(
'?'
))
...
@@ -65,7 +65,7 @@ EOF
...
@@ -65,7 +65,7 @@ EOF
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
{
if
(
null
===
$this
->
command
)
{
if
(
null
===
$this
->
command
)
{
$this
->
command
=
$this
->
application
->
get
Command
(
$input
->
getArgument
(
'command_name'
));
$this
->
command
=
$this
->
application
->
get
(
$input
->
getArgument
(
'command_name'
));
}
}
if
(
$input
->
getOption
(
'xml'
))
{
if
(
$input
->
getOption
(
'xml'
))
{
...
...
lib/vendor/Symfony/Component/Console/Command/ListCommand.php
View file @
3231fbd3
...
@@ -33,7 +33,7 @@ class ListCommand extends Command
...
@@ -33,7 +33,7 @@ class ListCommand extends Command
$this
$this
->
setDefinition
(
array
(
->
setDefinition
(
array
(
new
InputArgument
(
'namespace'
,
InputArgument
::
OPTIONAL
,
'The namespace name'
),
new
InputArgument
(
'namespace'
,
InputArgument
::
OPTIONAL
,
'The namespace name'
),
new
InputOption
(
'xml'
,
null
,
InputOption
::
PARAMETER
_NONE
,
'To output help as XML'
),
new
InputOption
(
'xml'
,
null
,
InputOption
::
VALUE
_NONE
,
'To output help as XML'
),
))
))
->
setName
(
'list'
)
->
setName
(
'list'
)
->
setDescription
(
'Lists commands'
)
->
setDescription
(
'Lists commands'
)
...
...
lib/vendor/Symfony/Component/Console/Input/ArgvInput.php
View file @
3231fbd3
...
@@ -88,7 +88,7 @@ class ArgvInput extends Input
...
@@ -88,7 +88,7 @@ class ArgvInput extends Input
$name
=
substr
(
$token
,
1
);
$name
=
substr
(
$token
,
1
);
if
(
strlen
(
$name
)
>
1
)
{
if
(
strlen
(
$name
)
>
1
)
{
if
(
$this
->
definition
->
hasShortcut
(
$name
[
0
])
&&
$this
->
definition
->
getOptionForShortcut
(
$name
[
0
])
->
accept
Parameter
())
{
if
(
$this
->
definition
->
hasShortcut
(
$name
[
0
])
&&
$this
->
definition
->
getOptionForShortcut
(
$name
[
0
])
->
accept
Value
())
{
// an option with a value (with no space)
// an option with a value (with no space)
$this
->
addShortOption
(
$name
[
0
],
substr
(
$name
,
1
));
$this
->
addShortOption
(
$name
[
0
],
substr
(
$name
,
1
));
}
else
{
}
else
{
...
@@ -115,7 +115,7 @@ class ArgvInput extends Input
...
@@ -115,7 +115,7 @@ class ArgvInput extends Input
}
}
$option
=
$this
->
definition
->
getOptionForShortcut
(
$name
[
$i
]);
$option
=
$this
->
definition
->
getOptionForShortcut
(
$name
[
$i
]);
if
(
$option
->
accept
Parameter
())
{
if
(
$option
->
accept
Value
())
{
$this
->
addLongOption
(
$option
->
getName
(),
$i
===
$len
-
1
?
null
:
substr
(
$name
,
$i
+
1
));
$this
->
addLongOption
(
$option
->
getName
(),
$i
===
$len
-
1
?
null
:
substr
(
$name
,
$i
+
1
));
break
;
break
;
...
@@ -190,7 +190,7 @@ class ArgvInput extends Input
...
@@ -190,7 +190,7 @@ class ArgvInput extends Input
$option
=
$this
->
definition
->
getOption
(
$name
);
$option
=
$this
->
definition
->
getOption
(
$name
);
if
(
null
===
$value
&&
$option
->
accept
Parameter
())
{
if
(
null
===
$value
&&
$option
->
accept
Value
())
{
// if option accepts an optional or mandatory argument
// if option accepts an optional or mandatory argument
// let's see if there is one provided
// let's see if there is one provided
$next
=
array_shift
(
$this
->
parsed
);
$next
=
array_shift
(
$this
->
parsed
);
...
@@ -202,11 +202,11 @@ class ArgvInput extends Input
...
@@ -202,11 +202,11 @@ class ArgvInput extends Input
}
}
if
(
null
===
$value
)
{
if
(
null
===
$value
)
{
if
(
$option
->
is
Parameter
Required
())
{
if
(
$option
->
is
Value
Required
())
{
throw
new
\RuntimeException
(
sprintf
(
'The "--%s" option requires a value.'
,
$name
));
throw
new
\RuntimeException
(
sprintf
(
'The "--%s" option requires a value.'
,
$name
));
}
}
$value
=
$option
->
is
Parameter
Optional
()
?
$option
->
getDefault
()
:
true
;
$value
=
$option
->
is
Value
Optional
()
?
$option
->
getDefault
()
:
true
;
}
}
$this
->
options
[
$name
]
=
$value
;
$this
->
options
[
$name
]
=
$value
;
...
...
lib/vendor/Symfony/Component/Console/Input/ArrayInput.php
View file @
3231fbd3
...
@@ -133,11 +133,11 @@ class ArrayInput extends Input
...
@@ -133,11 +133,11 @@ class ArrayInput extends Input
$option
=
$this
->
definition
->
getOption
(
$name
);
$option
=
$this
->
definition
->
getOption
(
$name
);
if
(
null
===
$value
)
{
if
(
null
===
$value
)
{
if
(
$option
->
is
Parameter
Required
())
{
if
(
$option
->
is
Value
Required
())
{
throw
new
\InvalidArgumentException
(
sprintf
(
'The "--%s" option requires a value.'
,
$name
));
throw
new
\InvalidArgumentException
(
sprintf
(
'The "--%s" option requires a value.'
,
$name
));
}
}
$value
=
$option
->
is
Parameter
Optional
()
?
$option
->
getDefault
()
:
true
;
$value
=
$option
->
is
Value
Optional
()
?
$option
->
getDefault
()
:
true
;
}
}
$this
->
options
[
$name
]
=
$value
;
$this
->
options
[
$name
]
=
$value
;
...
...
lib/vendor/Symfony/Component/Console/Input/InputDefinition.php
View file @
3231fbd3
...
@@ -18,7 +18,7 @@ namespace Symfony\Component\Console\Input;
...
@@ -18,7 +18,7 @@ namespace Symfony\Component\Console\Input;
*
*
* $definition = new InputDefinition(array(
* $definition = new InputDefinition(array(
* new InputArgument('name', InputArgument::REQUIRED),
* new InputArgument('name', InputArgument::REQUIRED),
* new InputOption('foo', 'f', InputOption::
PARAMETER
_REQUIRED),
* new InputOption('foo', 'f', InputOption::
VALUE
_REQUIRED),
* ));
* ));
*
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
...
@@ -347,7 +347,7 @@ class InputDefinition
...
@@ -347,7 +347,7 @@ class InputDefinition
$elements
=
array
();
$elements
=
array
();
foreach
(
$this
->
getOptions
()
as
$option
)
{
foreach
(
$this
->
getOptions
()
as
$option
)
{
$shortcut
=
$option
->
getShortcut
()
?
sprintf
(
'-%s|'
,
$option
->
getShortcut
())
:
''
;
$shortcut
=
$option
->
getShortcut
()
?
sprintf
(
'-%s|'
,
$option
->
getShortcut
())
:
''
;
$elements
[]
=
sprintf
(
'['
.
(
$option
->
is
ParameterRequired
()
?
'%s--%s="..."'
:
(
$option
->
isParameter
Optional
()
?
'%s--%s[="..."]'
:
'%s--%s'
))
.
']'
,
$shortcut
,
$option
->
getName
());
$elements
[]
=
sprintf
(
'['
.
(
$option
->
is
ValueRequired
()
?
'%s--%s="..."'
:
(
$option
->
isValue
Optional
()
?
'%s--%s[="..."]'
:
'%s--%s'
))
.
']'
,
$shortcut
,
$option
->
getName
());
}
}
foreach
(
$this
->
getArguments
()
as
$argument
)
{
foreach
(
$this
->
getArguments
()
as
$argument
)
{
...
@@ -399,7 +399,7 @@ class InputDefinition
...
@@ -399,7 +399,7 @@ class InputDefinition
$text
[]
=
'<comment>Options:</comment>'
;
$text
[]
=
'<comment>Options:</comment>'
;
foreach
(
$this
->
getOptions
()
as
$option
)
{
foreach
(
$this
->
getOptions
()
as
$option
)
{
if
(
$option
->
accept
Parameter
()
&&
null
!==
$option
->
getDefault
()
&&
(
!
is_array
(
$option
->
getDefault
())
||
count
(
$option
->
getDefault
())))
{
if
(
$option
->
accept
Value
()
&&
null
!==
$option
->
getDefault
()
&&
(
!
is_array
(
$option
->
getDefault
())
||
count
(
$option
->
getDefault
())))
{
$default
=
sprintf
(
'<comment> (default: %s)</comment>'
,
is_array
(
$option
->
getDefault
())
?
str_replace
(
"
\n
"
,
''
,
print_r
(
$option
->
getDefault
(),
true
))
:
$option
->
getDefault
());
$default
=
sprintf
(
'<comment> (default: %s)</comment>'
,
is_array
(
$option
->
getDefault
())
?
str_replace
(
"
\n
"
,
''
,
print_r
(
$option
->
getDefault
(),
true
))
:
$option
->
getDefault
());
}
else
{
}
else
{
$default
=
''
;
$default
=
''
;
...
@@ -450,13 +450,13 @@ class InputDefinition
...
@@ -450,13 +450,13 @@ class InputDefinition
$optionsXML
->
appendChild
(
$optionXML
=
$dom
->
createElement
(
'option'
));
$optionsXML
->
appendChild
(
$optionXML
=
$dom
->
createElement
(
'option'
));
$optionXML
->
setAttribute
(
'name'
,
'--'
.
$option
->
getName
());
$optionXML
->
setAttribute
(
'name'
,
'--'
.
$option
->
getName
());
$optionXML
->
setAttribute
(
'shortcut'
,
$option
->
getShortcut
()
?
'-'
.
$option
->
getShortcut
()
:
''
);
$optionXML
->
setAttribute
(
'shortcut'
,
$option
->
getShortcut
()
?
'-'
.
$option
->
getShortcut
()
:
''
);
$optionXML
->
setAttribute
(
'accept_
parameter'
,
$option
->
acceptParameter
()
?
1
:
0
);
$optionXML
->
setAttribute
(
'accept_
value'
,
$option
->
acceptValue
()
?
1
:
0
);
$optionXML
->
setAttribute
(
'is_
parameter_required'
,
$option
->
isParameter
Required
()
?
1
:
0
);
$optionXML
->
setAttribute
(
'is_
value_required'
,
$option
->
isValue
Required
()
?
1
:
0
);
$optionXML
->
setAttribute
(
'is_multiple'
,
$option
->
isArray
()
?
1
:
0
);
$optionXML
->
setAttribute
(
'is_multiple'
,
$option
->
isArray
()
?
1
:
0
);
$optionXML
->
appendChild
(
$descriptionXML
=
$dom
->
createElement
(
'description'
));
$optionXML
->
appendChild
(
$descriptionXML
=
$dom
->
createElement
(
'description'
));
$descriptionXML
->
appendChild
(
$dom
->
createTextNode
(
$option
->
getDescription
()));
$descriptionXML
->
appendChild
(
$dom
->
createTextNode
(
$option
->
getDescription
()));
if
(
$option
->
accept
Parameter
())
{
if
(
$option
->
accept
Value
())
{
$optionXML
->
appendChild
(
$defaultsXML
=
$dom
->
createElement
(
'defaults'
));
$optionXML
->
appendChild
(
$defaultsXML
=
$dom
->
createElement
(
'defaults'
));
$defaults
=
is_array
(
$option
->
getDefault
())
?
$option
->
getDefault
()
:
(
$option
->
getDefault
()
?
array
(
$option
->
getDefault
())
:
array
());
$defaults
=
is_array
(
$option
->
getDefault
())
?
$option
->
getDefault
()
:
(
$option
->
getDefault
()
?
array
(
$option
->
getDefault
())
:
array
());
foreach
(
$defaults
as
$default
)
{
foreach
(
$defaults
as
$default
)
{
...
...
lib/vendor/Symfony/Component/Console/Input/InputOption.php
View file @
3231fbd3
...
@@ -18,10 +18,10 @@ namespace Symfony\Component\Console\Input;
...
@@ -18,10 +18,10 @@ namespace Symfony\Component\Console\Input;
*/
*/
class
InputOption
class
InputOption
{
{
const
PARAMETER
_NONE
=
1
;
const
VALUE
_NONE
=
1
;
const
PARAMETER
_REQUIRED
=
2
;
const
VALUE
_REQUIRED
=
2
;
const
PARAMETER
_OPTIONAL
=
4
;
const
VALUE
_OPTIONAL
=
4
;
const
PARAMETER
_IS_ARRAY
=
8
;
const
VALUE
_IS_ARRAY
=
8
;
protected
$name
;
protected
$name
;
protected
$shortcut
;
protected
$shortcut
;
...
@@ -34,9 +34,9 @@ class InputOption
...
@@ -34,9 +34,9 @@ class InputOption
*
*
* @param string $name The option name
* @param string $name The option name
* @param string $shortcut The shortcut (can be null)
* @param string $shortcut The shortcut (can be null)
* @param integer $mode The option mode:
self::PARAMETER_REQUIRED, self::PARAMETER_NONE or self::PARAMETER_OPTIONAL
* @param integer $mode The option mode:
One of the VALUE_* constants
* @param string $description A description text
* @param string $description A description text
* @param mixed $default The default value (must be null for self::
PARAMETER_REQUIRED or self::PARAMETER
_NONE)
* @param mixed $default The default value (must be null for self::
VALUE_REQUIRED or self::VALUE
_NONE)
*
*
* @throws \InvalidArgumentException If option mode is invalid or incompatible
* @throws \InvalidArgumentException If option mode is invalid or incompatible
*/
*/
...
@@ -57,7 +57,7 @@ class InputOption
...
@@ -57,7 +57,7 @@ class InputOption
}
}
if
(
null
===
$mode
)
{
if
(
null
===
$mode
)
{
$mode
=
self
::
PARAMETER
_NONE
;
$mode
=
self
::
VALUE
_NONE
;
}
else
if
(
!
is_int
(
$mode
)
||
$mode
>
15
)
{
}
else
if
(
!
is_int
(
$mode
)
||
$mode
>
15
)
{
throw
new
\InvalidArgumentException
(
sprintf
(
'Option mode "%s" is not valid.'
,
$mode
));
throw
new
\InvalidArgumentException
(
sprintf
(
'Option mode "%s" is not valid.'
,
$mode
));
}
}
...
@@ -67,8 +67,8 @@ class InputOption
...
@@ -67,8 +67,8 @@ class InputOption
$this
->
mode
=
$mode
;
$this
->
mode
=
$mode
;
$this
->
description
=
$description
;
$this
->
description
=
$description
;
if
(
$this
->
isArray
()
&&
!
$this
->
accept
Parameter
())
{
if
(
$this
->
isArray
()
&&
!
$this
->
accept
Value
())
{
throw
new
\InvalidArgumentException
(
'Impossible to have an option mode
PARAMETER_IS_ARRAY if the option does not accept a parameter
.'
);
throw
new
\InvalidArgumentException
(
'Impossible to have an option mode
VALUE_IS_ARRAY if the option does not accept a value
.'
);
}
}
$this
->
setDefault
(
$default
);
$this
->
setDefault
(
$default
);
...
@@ -95,43 +95,43 @@ class InputOption
...
@@ -95,43 +95,43 @@ class InputOption
}
}
/**
/**
* Returns true if the option accept
a parameter
.
* Returns true if the option accept
s a value
.
*
*
* @return Boolean true if
parameter mode is not self::PARAMETER
_NONE, false otherwise
* @return Boolean true if
value mode is not self::VALUE
_NONE, false otherwise
*/
*/
public
function
accept
Parameter
()
public
function
accept
Value
()
{
{
return
$this
->
is
ParameterRequired
()
||
$this
->
isParameter
Optional
();
return
$this
->
is
ValueRequired
()
||
$this
->
isValue
Optional
();
}
}
/**
/**
* Returns true if the option requires a
parameter
.
* Returns true if the option requires a
value
.
*
*
* @return Boolean true if
parameter mode is self::PARAMETER
_REQUIRED, false otherwise
* @return Boolean true if
value mode is self::VALUE
_REQUIRED, false otherwise
*/
*/
public
function
is
Parameter
Required
()
public
function
is
Value
Required
()
{
{
return
self
::
PARAMETER_REQUIRED
===
(
self
::
PARAMETER
_REQUIRED
&
$this
->
mode
);
return
self
::
VALUE_REQUIRED
===
(
self
::
VALUE
_REQUIRED
&
$this
->
mode
);
}
}
/**
/**
* Returns true if the option takes an optional
parameter
.
* Returns true if the option takes an optional
value
.
*
*
* @return Boolean true if
parameter mode is self::PARAMETER
_OPTIONAL, false otherwise
* @return Boolean true if
value mode is self::VALUE
_OPTIONAL, false otherwise
*/
*/
public
function
is
Parameter
Optional
()
public
function
is
Value
Optional
()
{
{
return
self
::
PARAMETER_OPTIONAL
===
(
self
::
PARAMETER
_OPTIONAL
&
$this
->
mode
);
return
self
::
VALUE_OPTIONAL
===
(
self
::
VALUE
_OPTIONAL
&
$this
->
mode
);
}
}
/**
/**
* Returns true if the option can take multiple values.
* Returns true if the option can take multiple values.
*
*
* @return Boolean true if mode is self::
PARAMETER
_IS_ARRAY, false otherwise
* @return Boolean true if mode is self::
VALUE
_IS_ARRAY, false otherwise
*/
*/
public
function
isArray
()
public
function
isArray
()
{
{
return
self
::
PARAMETER_IS_ARRAY
===
(
self
::
PARAMETER
_IS_ARRAY
&
$this
->
mode
);
return
self
::
VALUE_IS_ARRAY
===
(
self
::
VALUE
_IS_ARRAY
&
$this
->
mode
);
}
}
/**
/**
...
@@ -141,8 +141,8 @@ class InputOption
...
@@ -141,8 +141,8 @@ class InputOption
*/
*/
public
function
setDefault
(
$default
=
null
)
public
function
setDefault
(
$default
=
null
)
{
{
if
(
self
::
PARAMETER_NONE
===
(
self
::
PARAMETER
_NONE
&
$this
->
mode
)
&&
null
!==
$default
)
{
if
(
self
::
VALUE_NONE
===
(
self
::
VALUE
_NONE
&
$this
->
mode
)
&&
null
!==
$default
)
{
throw
new
\LogicException
(
'Cannot set a default value when using Option::
PARAMETER
_NONE mode.'
);
throw
new
\LogicException
(
'Cannot set a default value when using Option::
VALUE
_NONE mode.'
);
}
}
if
(
$this
->
isArray
())
{
if
(
$this
->
isArray
())
{
...
@@ -153,7 +153,7 @@ class InputOption
...
@@ -153,7 +153,7 @@ class InputOption
}
}
}
}
$this
->
default
=
$this
->
accept
Parameter
()
?
$default
:
false
;
$this
->
default
=
$this
->
accept
Value
()
?
$default
:
false
;
}
}
/**
/**
...
...
lib/vendor/Symfony/Component/Console/Shell.php
View file @
3231fbd3
...
@@ -97,7 +97,7 @@ class Shell
...
@@ -97,7 +97,7 @@ class Shell
// task name?
// task name?
if
(
false
===
strpos
(
$text
,
' '
)
||
!
$text
)
{
if
(
false
===
strpos
(
$text
,
' '
)
||
!
$text
)
{
return
array_keys
(
$this
->
application
->
getCommands
());
return
array_keys
(
$this
->
application
->
all
());
}
}
// options and arguments?
// options and arguments?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment