Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getCommandDocument example
$rootXml
->
appendChild
(
$commandsXML
=
$dom
->
createElement
(
'commands'
)
)
;
$description
=
new
ApplicationDescription
(
$application
,
$namespace
, true
)
;
if
(
$namespace
)
{
$commandsXML
->
setAttribute
(
'namespace',
$namespace
)
;
}
foreach
(
$description
->
getCommands
(
)
as
$command
)
{
$this
->
appendDocument
(
$commandsXML
,
$this
->
getCommandDocument
(
$command
,
$short
)
)
;
}
if
(
!
$namespace
)
{
$rootXml
->
appendChild
(
$namespacesXML
=
$dom
->
createElement
(
'namespaces'
)
)
;
foreach
(
$description
->
getNamespaces
(
)
as
$namespaceDescription
)
{
$namespacesXML
->
appendChild
(
$namespaceArrayXML
=
$dom
->
createElement
(
'namespace'
)
)
;
$namespaceArrayXML
->
setAttribute
(
'id',
$namespaceDescription
[
'id'
]
)
;
foreach
(
$namespaceDescription
[
'commands'
]
as
$name
)
{
$namespaceArrayXML
->
appendChild
(
$commandXML
=
$dom
->
createElement
(
'command'
)
)
;
$rootXml
->
appendChild
(
$commandsXML
=
$dom
->
createElement
(
'commands'
)
)
;
$description
=
new
ApplicationDescription
(
$application
,
$namespace
, true
)
;
if
(
$namespace
)
{
$commandsXML
->
setAttribute
(
'namespace',
$namespace
)
;
}
foreach
(
$description
->
getCommands
(
)
as
$command
)
{
$this
->
appendDocument
(
$commandsXML
,
$this
->
getCommandDocument
(
$command
,
$short
)
)
;
}
if
(
!
$namespace
)
{
$rootXml
->
appendChild
(
$namespacesXML
=
$dom
->
createElement
(
'namespaces'
)
)
;
foreach
(
$description
->
getNamespaces
(
)
as
$namespaceDescription
)
{
$namespacesXML
->
appendChild
(
$namespaceArrayXML
=
$dom
->
createElement
(
'namespace'
)
)
;
$namespaceArrayXML
->
setAttribute
(
'id',
$namespaceDescription
[
'id'
]
)
;
foreach
(
$namespaceDescription
[
'commands'
]
as
$name
)
{
$namespaceArrayXML
->
appendChild
(
$commandXML
=
$dom
->
createElement
(
'command'
)
)
;