Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getInputArgumentDocument example
class
XmlDescriptor
extends
Descriptor
{
public
function
getInputDefinitionDocument
(
InputDefinition
$definition
)
: \DOMDocument
{
$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
{
class
XmlDescriptor
extends
Descriptor
{
public
function
getInputDefinitionDocument
(
InputDefinition
$definition
)
: \DOMDocument
{
$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
{