@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | if($fileHeader === null){ |
136 | 136 | $this->_fileHeader = '<?xml version="1.0" encoding="' . $this->_encoding .'"?>'; |
137 | - } |
|
138 | - else{ |
|
137 | + } else{ |
|
139 | 138 | $this->_fileHeader = $fileHeader; |
140 | 139 | } |
141 | 140 | } |
@@ -176,8 +175,7 @@ discard block |
||
176 | 175 | */ |
177 | 176 | if($fileName === null){ |
178 | 177 | $this->setFileName(tempnam(sys_get_temp_dir(), $this->_fileNamePrefix)); |
179 | - } |
|
180 | - else{ |
|
178 | + } else{ |
|
181 | 179 | $this->setFileName($fileName); |
182 | 180 | } |
183 | 181 | |
@@ -205,8 +203,7 @@ discard block |
||
205 | 203 | public function openFile($autoAddHeader = true){ |
206 | 204 | try { |
207 | 205 | $this->_filePointer = fopen($this->_fileName, $this->_writeMode); |
208 | - } |
|
209 | - catch (\Exception $e){ |
|
206 | + } catch (\Exception $e){ |
|
210 | 207 | die('File cannot be opened: ' . $e->getMessage()); |
211 | 208 | } |
212 | 209 | |
@@ -321,8 +318,7 @@ discard block |
||
321 | 318 | */ |
322 | 319 | if (is_numeric($value) === false && strlen(trim($value)) < 1) { |
323 | 320 | $this->blankXMLElement($tag); |
324 | - } |
|
325 | - else { |
|
321 | + } else { |
|
326 | 322 | |
327 | 323 | /** |
328 | 324 | * Non-empty element |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param $encoding |
91 | 91 | */ |
92 | 92 | public function setEncoding($encoding){ |
93 | - $this->_encoding = $encoding; |
|
93 | + $this->_encoding = $encoding; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -263,37 +263,37 @@ discard block |
||
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - /** |
|
267 | - * Determines if an array is associative. |
|
268 | - * @param array $array |
|
269 | - * @return bool |
|
270 | - */ |
|
271 | - function isAssoc(array $array) |
|
272 | - { |
|
273 | - $keys = array_keys($array); |
|
274 | - |
|
275 | - return array_keys($keys) !== $keys; |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * Concatenates the attribute - value pairs into a string |
|
280 | - * |
|
281 | - * @param array $attr |
|
282 | - */ |
|
266 | + /** |
|
267 | + * Determines if an array is associative. |
|
268 | + * @param array $array |
|
269 | + * @return bool |
|
270 | + */ |
|
271 | + function isAssoc(array $array) |
|
272 | + { |
|
273 | + $keys = array_keys($array); |
|
274 | + |
|
275 | + return array_keys($keys) !== $keys; |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * Concatenates the attribute - value pairs into a string |
|
280 | + * |
|
281 | + * @param array $attr |
|
282 | + */ |
|
283 | 283 | private function _getAttributes ($attr = null) |
284 | 284 | { |
285 | - $str = ''; |
|
286 | - |
|
287 | - if(!is_null($attr) && is_array($attr)) { |
|
288 | - // check if is an associative array |
|
289 | - if($this->isAssoc($attr)) { |
|
290 | - foreach ($attr as $name => $value) { |
|
291 | - $str .= ' ' . $name . '="' . str_replace('"', "'", $value) . '"'; |
|
292 | - } |
|
293 | - } |
|
294 | - } |
|
295 | - |
|
296 | - return $str; |
|
285 | + $str = ''; |
|
286 | + |
|
287 | + if(!is_null($attr) && is_array($attr)) { |
|
288 | + // check if is an associative array |
|
289 | + if($this->isAssoc($attr)) { |
|
290 | + foreach ($attr as $name => $value) { |
|
291 | + $str .= ' ' . $name . '="' . str_replace('"', "'", $value) . '"'; |
|
292 | + } |
|
293 | + } |
|
294 | + } |
|
295 | + |
|
296 | + return $str; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |