Code Duplication    Length = 5-5 lines in 3 locations

includes/api/ApiQueryRevisionsBase.php 1 location

@@ 289-293 (lines=5) @@
286
						Parser::OT_PREPROCESS
287
					);
288
					$dom = $wgParser->preprocessToDom( $t );
289
					if ( is_callable( [ $dom, 'saveXML' ] ) ) {
290
						$xml = $dom->saveXML();
291
					} else {
292
						$xml = $dom->__toString();
293
					}
294
					$vals['parsetree'] = $xml;
295
				} else {
296
					$vals['badcontentformatforparsetree'] = true;

includes/api/ApiExpandTemplates.php 1 location

@@ 90-94 (lines=5) @@
87
		if ( isset( $prop['parsetree'] ) || $params['generatexml'] ) {
88
			$wgParser->startExternalParse( $title_obj, $options, Parser::OT_PREPROCESS );
89
			$dom = $wgParser->preprocessToDom( $params['text'] );
90
			if ( is_callable( [ $dom, 'saveXML' ] ) ) {
91
				$xml = $dom->saveXML();
92
			} else {
93
				$xml = $dom->__toString();
94
			}
95
			if ( isset( $prop['parsetree'] ) ) {
96
				unset( $prop['parsetree'] );
97
				$retval['parsetree'] = $xml;

includes/api/ApiParse.php 1 location

@@ 443-447 (lines=5) @@
440
441
			$wgParser->startExternalParse( $titleObj, $popts, Parser::OT_PREPROCESS );
442
			$dom = $wgParser->preprocessToDom( $this->content->getNativeData() );
443
			if ( is_callable( [ $dom, 'saveXML' ] ) ) {
444
				$xml = $dom->saveXML();
445
			} else {
446
				$xml = $dom->__toString();
447
			}
448
			$result_array['parsetree'] = $xml;
449
			$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'parsetree';
450
		}