Code Duplication    Length = 14-14 lines in 2 locations

includes/parser/Preprocessor_DOM.php 1 location

@@ 201-214 (lines=14) @@
198
		$xmlishElements = $this->parser->getStripList();
199
		$xmlishAllowMissingEndTag = [ 'includeonly', 'noinclude', 'onlyinclude' ];
200
		$enableOnlyinclude = false;
201
		if ( $forInclusion ) {
202
			$ignoredTags = [ 'includeonly', '/includeonly' ];
203
			$ignoredElements = [ 'noinclude' ];
204
			$xmlishElements[] = 'noinclude';
205
			if ( strpos( $text, '<onlyinclude>' ) !== false
206
				&& strpos( $text, '</onlyinclude>' ) !== false
207
			) {
208
				$enableOnlyinclude = true;
209
			}
210
		} else {
211
			$ignoredTags = [ 'noinclude', '/noinclude', 'onlyinclude', '/onlyinclude' ];
212
			$ignoredElements = [ 'includeonly' ];
213
			$xmlishElements[] = 'includeonly';
214
		}
215
		$xmlishRegex = implode( '|', array_merge( $xmlishElements, $ignoredTags ) );
216
217
		// Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset

includes/parser/Preprocessor_Hash.php 1 location

@@ 133-146 (lines=14) @@
130
		$xmlishElements = $this->parser->getStripList();
131
		$xmlishAllowMissingEndTag = [ 'includeonly', 'noinclude', 'onlyinclude' ];
132
		$enableOnlyinclude = false;
133
		if ( $forInclusion ) {
134
			$ignoredTags = [ 'includeonly', '/includeonly' ];
135
			$ignoredElements = [ 'noinclude' ];
136
			$xmlishElements[] = 'noinclude';
137
			if ( strpos( $text, '<onlyinclude>' ) !== false
138
				&& strpos( $text, '</onlyinclude>' ) !== false
139
			) {
140
				$enableOnlyinclude = true;
141
			}
142
		} else {
143
			$ignoredTags = [ 'noinclude', '/noinclude', 'onlyinclude', '/onlyinclude' ];
144
			$ignoredElements = [ 'includeonly' ];
145
			$xmlishElements[] = 'includeonly';
146
		}
147
		$xmlishRegex = implode( '|', array_merge( $xmlishElements, $ignoredTags ) );
148
149
		// Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset