File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ v1.2.0 [2015-12-21]
1010- Added ability configuration of ` XMLWriter ` via ` $config ` param to ` __construct() `
1111method.
1212- Added ` libxml ` to required section of ` composer.json ` .
13+ - Small enhancements and fixes.
1314
1415v1.1.0 [ 2015-08-27]
1516-------------------
Original file line number Diff line number Diff line change 4848 */
4949class XmlConstructor extends XMLWriter
5050{
51+ /**
52+ * @var boolean Flag of completed preparing.
53+ */
5154 private $ _prepared = false ;
55+ /**
56+ * @var boolean Flag of added start document tag.
57+ * @since 1.2.0
58+ */
59+ private $ _startDocument = false ;
5260
5361 /**
5462 * Constructor of XML document structure.
@@ -119,7 +127,9 @@ public function toOutput()
119127 protected function preparing ()
120128 {
121129 if (!$ this ->_prepared ) {
122- $ this ->endDocument ();
130+ if ($ this ->_startDocument ) {
131+ $ this ->endDocument ();
132+ }
123133 $ this ->_prepared = true ;
124134 }
125135 return $ this ;
@@ -166,7 +176,9 @@ protected function configIndentString($string)
166176 protected function configStartDocument ($ arguments )
167177 {
168178 if (is_array ($ arguments )) {
169- call_user_func_array ([$ this , 'startDocument ' ], $ arguments );
179+ if (call_user_func_array ([$ this , 'startDocument ' ], $ arguments )) {
180+ $ this ->_startDocument = true ;
181+ }
170182 }
171183 }
172184}
You can’t perform that action at this time.
0 commit comments