Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getInputOptionDocument example
$dom
=
new
\
DOMDocument
(
'1.0', 'UTF-8'
)
;
$dom
->
appendChild
(
$definitionXML
=
$dom
->
createElement
(
'definition'
)
)
;
$definitionXML
->
appendChild
(
$argumentsXML
=
$dom
->
createElement
(
'arguments'
)
)
;
foreach
(
$definition
->
getArguments
(
)
as
$argument
)
{
$this
->
appendDocument
(
$argumentsXML
,
$this
->
getInputArgumentDocument
(
$argument
)
)
;
}
$definitionXML
->
appendChild
(
$optionsXML
=
$dom
->
createElement
(
'options'
)
)
;
foreach
(
$definition
->
getOptions
(
)
as
$option
)
{
$this
->
appendDocument
(
$optionsXML
,
$this
->
getInputOptionDocument
(
$option
)
)
;
}
return
$dom
;
}
public
function
getCommandDocument
(
Command
$command
, bool
$short
= false
)
: \DOMDocument
{
$dom
=
new
\
DOMDocument
(
'1.0', 'UTF-8'
)
;
$dom
->
appendChild
(
$commandXML
=
$dom
->
createElement
(
'command'
)
)
;
$commandXML
->
setAttribute
(
'id',
$command
->
getName
(
)
)
;
$dom
=
new
\
DOMDocument
(
'1.0', 'UTF-8'
)
;
$dom
->
appendChild
(
$definitionXML
=
$dom
->
createElement
(
'definition'
)
)
;
$definitionXML
->
appendChild
(
$argumentsXML
=
$dom
->
createElement
(
'arguments'
)
)
;
foreach
(
$definition
->
getArguments
(
)
as
$argument
)
{
$this
->
appendDocument
(
$argumentsXML
,
$this
->
getInputArgumentDocument
(
$argument
)
)
;
}
$definitionXML
->
appendChild
(
$optionsXML
=
$dom
->
createElement
(
'options'
)
)
;
foreach
(
$definition
->
getOptions
(
)
as
$option
)
{
$this
->
appendDocument
(
$optionsXML
,
$this
->
getInputOptionDocument
(
$option
)
)
;
}
return
$dom
;
}
public
function
getCommandDocument
(
Command
$command
, bool
$short
= false
)
: \DOMDocument
{
$dom
=
new
\
DOMDocument
(
'1.0', 'UTF-8'
)
;
$dom
->
appendChild
(
$commandXML
=
$dom
->
createElement
(
'command'
)
)
;
$commandXML
->
setAttribute
(
'id',
$command
->
getName
(
)
)
;