1 | <?php |
||
19 | class XmlExportService |
||
20 | { |
||
21 | /** |
||
22 | * @var XmlConvertibleInterface |
||
23 | */ |
||
24 | public $object; |
||
25 | |||
26 | /** |
||
27 | * @var \DOMDocument |
||
28 | */ |
||
29 | public $document; |
||
30 | |||
31 | /** |
||
32 | * XmlExportService constructor. |
||
33 | * @param XmlConvertibleInterface $object |
||
34 | * @param \DOMDocument|null $document |
||
35 | */ |
||
36 | 14 | public function __construct(XmlConvertibleInterface $object, \DOMDocument $document = null) |
|
41 | |||
42 | /** |
||
43 | * Converting object to \DOMElement |
||
44 | * |
||
45 | * @return \DOMElement |
||
46 | */ |
||
47 | 14 | public function export() |
|
70 | |||
71 | /** |
||
72 | * Creating new element to put object into |
||
73 | * |
||
74 | * @return \DOMElement |
||
75 | */ |
||
76 | 14 | protected function createElement() :\DOMElement |
|
82 | |||
83 | /** |
||
84 | * Preparing all children to export |
||
85 | * |
||
86 | * @return \Closure |
||
87 | */ |
||
88 | 13 | protected function mapChild() :\Closure |
|
96 | |||
97 | /** |
||
98 | * Can we put current attribute to XML |
||
99 | * |
||
100 | * @return \Closure |
||
101 | */ |
||
102 | protected function getIsAttribute() :\Closure{ |
||
107 | |||
108 | /** |
||
109 | * @return XmlConvertibleInterface |
||
110 | */ |
||
111 | 14 | public function getObject(): XmlConvertibleInterface |
|
115 | |||
116 | /** |
||
117 | * @param XmlConvertibleInterface $object |
||
118 | * @return $this |
||
119 | */ |
||
120 | 14 | public function setObject(XmlConvertibleInterface $object) |
|
125 | |||
126 | /** |
||
127 | * @return \DOMDocument |
||
128 | */ |
||
129 | 14 | public function getDocument(): \DOMDocument |
|
133 | |||
134 | /** |
||
135 | * @param \DOMDocument $document |
||
136 | * @return $this |
||
137 | */ |
||
138 | 14 | public function setDocument(\DOMDocument $document = null) |
|
143 | } |