Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getApplicationTitle example
$definition
=
$command
->
getDefinition
(
)
;
if
(
$definition
->
getOptions
(
)
||
$definition
->
getArguments
(
)
)
{
$this
->
write
(
"\n\n"
)
;
$this
->
describeInputDefinition
(
$definition
)
;
}
}
protected
function
describeApplication
(
Application
$application
, array
$options
=
[
]
)
: void
{
$describedNamespace
=
$options
[
'namespace'
]
?? null;
$description
=
new
ApplicationDescription
(
$application
,
$describedNamespace
)
;
$title
=
$this
->
getApplicationTitle
(
$application
)
;
$this
->
write
(
$title
."\n".
str_repeat
(
'=', Helper::
width
(
$title
)
)
)
;
foreach
(
$description
->
getNamespaces
(
)
as
$namespace
)
{
if
(
ApplicationDescription::GLOBAL_NAMESPACE !==
$namespace
[
'id'
]
)
{
$this
->
write
(
"\n\n"
)
;
$this
->
write
(
'**'.
$namespace
[
'id'
]
.':**'
)
;
}
$this
->
write
(
"\n\n"
)
;
$this
->
write
(
implode
(
"\n",
array_map
(
fn
(
$commandName
)
=>
sprintf
(
'* [`%s`](#%s)',
$commandName
,
str_replace
(
':', '',
$description
->
getCommand
(
$commandName
)
->
getName
(
)
)
)
,
$namespace
[
'commands'
]
)
)
)
;
}
$definition
=
$command
->
getDefinition
(
)
;
if
(
$definition
->
getOptions
(
)
||
$definition
->
getArguments
(
)
)
{
$this
->
write
(
"\n\n"
)
;
$this
->
describeInputDefinition
(
$definition
)
;
}
}
protected
function
describeApplication
(
Application
$application
, array
$options
=
[
]
)
: void
{
$description
=
new
ApplicationDescription
(
$application
,
$options
[
'namespace'
]
?? null
)
;
$title
=
$this
->
getApplicationTitle
(
$application
)
;
$this
->
write
(
$title
."\n".
str_repeat
(
$this
->partChar, Helper::
width
(
$title
)
)
)
;
$this
->
createTableOfContents
(
$description
,
$application
)
;
$this
->
describeCommands
(
$application
,
$options
)
;
}
private
function
getApplicationTitle
(
Application
$application
)
: string
{
if
(
'UNKNOWN' ===
$application
->
getName
(
)
)
{
return
'Console Tool';
}
$definition
=
$command
->
getDefinition
(
)
;
if
(
$definition
->
getOptions
(
)
||
$definition
->
getArguments
(
)
)
{
$this
->
write
(
"\n\n"
)
;
$this
->
describeInputDefinition
(
$definition
)
;
}
}
protected
function
describeApplication
(
Application
$application
, array
$options
=
[
]
)
: void
{
$description
=
new
ApplicationDescription
(
$application
,
$options
[
'namespace'
]
?? null
)
;
$title
=
$this
->
getApplicationTitle
(
$application
)
;
$this
->
write
(
$title
."\n".
str_repeat
(
$this
->partChar, Helper::
width
(
$title
)
)
)
;
$this
->
createTableOfContents
(
$description
,
$application
)
;
$this
->
describeCommands
(
$application
,
$options
)
;
}
private
function
getApplicationTitle
(
Application
$application
)
: string
{
if
(
'UNKNOWN' ===
$application
->
getName
(
)
)
{
return
'Console Tool';
}
$definition
=
$command
->
getDefinition
(
)
;
if
(
$definition
->
getOptions
(
)
||
$definition
->
getArguments
(
)
)
{
$this
->
write
(
"\n\n"
)
;
$this
->
describeInputDefinition
(
$definition
)
;
}
}
protected
function
describeApplication
(
Application
$application
, array
$options
=
[
]
)
: void
{
$describedNamespace
=
$options
[
'namespace'
]
?? null;
$description
=
new
ApplicationDescription
(
$application
,
$describedNamespace
)
;
$title
=
$this
->
getApplicationTitle
(
$application
)
;
$this
->
write
(
$title
."\n".
str_repeat
(
'=', Helper::
width
(
$title
)
)
)
;
foreach
(
$description
->
getNamespaces
(
)
as
$namespace
)
{
if
(
ApplicationDescription::GLOBAL_NAMESPACE !==
$namespace
[
'id'
]
)
{
$this
->
write
(
"\n\n"
)
;
$this
->
write
(
'**'.
$namespace
[
'id'
]
.':**'
)
;
}
$this
->
write
(
"\n\n"
)
;
$this
->
write
(
implode
(
"\n",
array_map
(
fn
(
$commandName
)
=>
sprintf
(
'* [`%s`](#%s)',
$commandName
,
str_replace
(
':', '',
$description
->
getCommand
(
$commandName
)
->
getName
(
)
)
)
,
$namespace
[
'commands'
]
)
)
)
;
}