1 | <?php |
||
23 | class XmlEncoder implements EncoderInterface |
||
24 | { |
||
25 | /** |
||
26 | * @inheritDoc |
||
27 | */ |
||
28 | 27 | public function encode(Order $order) |
|
34 | |||
35 | /** |
||
36 | * Extract the data as an array from the Order. |
||
37 | * |
||
38 | * @param Order $order |
||
39 | * The Order to extract the data from. |
||
40 | * |
||
41 | * @return array |
||
42 | * The extracted data in the same structure as the XML will be. |
||
43 | */ |
||
44 | 27 | protected function extractData(Order $order) |
|
65 | 24 | ||
66 | 24 | /** |
|
67 | 27 | * Create the structure for the target languages. |
|
68 | * |
||
69 | 3 | * @param Order $order |
|
70 | * The Order to extract the data from. |
||
71 | 27 | * |
|
72 | * @return array |
||
73 | * The structure for the target languages. |
||
74 | */ |
||
75 | protected function extractTargetLanguagesData(Order $order) |
||
88 | 27 | ||
89 | 24 | /** |
|
90 | 24 | * Extract the instructions from the order (if any). |
|
91 | * |
||
92 | 27 | * |
|
93 | */ |
||
94 | 27 | protected function extractInstructionsData(Order $order) |
|
104 | 27 | ||
105 | /** |
||
106 | 27 | * Create the structure for the files to translate. |
|
107 | 24 | * |
|
108 | * @param Order $order |
||
109 | * The Order to extract the data from. |
||
110 | 3 | * |
|
111 | * @return array |
||
112 | * The structure for the attached files. |
||
113 | */ |
||
114 | protected function extractInputFilesData(Order $order) |
||
130 | 3 | ||
131 | 3 | /** |
|
132 | 3 | * Create the order XML. |
|
133 | * |
||
134 | 27 | * @param array $data |
|
135 | * The data array to create the XML from. |
||
136 | 27 | * |
|
137 | * @return \DOMDocument |
||
138 | * The generated XML object. |
||
139 | */ |
||
140 | protected function createXml(array $data) |
||
163 | |||
164 | 27 | /** |
|
165 | 27 | * Adds an array to an existing SimpleXMLElement object. |
|
166 | * |
||
167 | * @param array $array |
||
168 | 27 | * Array with values. |
|
169 | 27 | * @param \DOMElement $element |
|
170 | * The Dom element to who the data should be added as children. |
||
171 | */ |
||
172 | protected function arrayToXml(array $array, \DOMElement $element) |
||
200 | } |
||
201 |