Code Duplication    Length = 13-15 lines in 2 locations

includes/parser/Parser.php 2 locations

@@ 4622-4634 (lines=13) @@
4619
	 * @throws MWException
4620
	 * @return callable|null The old value of the mTagHooks array associated with the hook
4621
	 */
4622
	public function setHook( $tag, $callback ) {
4623
		$tag = strtolower( $tag );
4624
		if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
4625
			throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
4626
		}
4627
		$oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null;
4628
		$this->mTagHooks[$tag] = $callback;
4629
		if ( !in_array( $tag, $this->mStripList ) ) {
4630
			$this->mStripList[] = $tag;
4631
		}
4632
4633
		return $oldVal;
4634
	}
4635
4636
	/**
4637
	 * As setHook(), but letting the contents be parsed.
@@ 4768-4782 (lines=15) @@
4765
	 * @throws MWException
4766
	 * @return null
4767
	 */
4768
	public function setFunctionTagHook( $tag, $callback, $flags ) {
4769
		$tag = strtolower( $tag );
4770
		if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
4771
			throw new MWException( "Invalid character {$m[0]} in setFunctionTagHook('$tag', ...) call" );
4772
		}
4773
		$old = isset( $this->mFunctionTagHooks[$tag] ) ?
4774
			$this->mFunctionTagHooks[$tag] : null;
4775
		$this->mFunctionTagHooks[$tag] = [ $callback, $flags ];
4776
4777
		if ( !in_array( $tag, $this->mStripList ) ) {
4778
			$this->mStripList[] = $tag;
4779
		}
4780
4781
		return $old;
4782
	}
4783
4784
	/**
4785
	 * Replace "<!--LINK-->" link placeholders with actual links, in the buffer