Code Duplication    Length = 13-15 lines in 2 locations

includes/parser/Parser.php 2 locations

@@ 4661-4673 (lines=13) @@
4658
	 * @throws MWException
4659
	 * @return callable|null The old value of the mTagHooks array associated with the hook
4660
	 */
4661
	public function setHook( $tag, $callback ) {
4662
		$tag = strtolower( $tag );
4663
		if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
4664
			throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
4665
		}
4666
		$oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null;
4667
		$this->mTagHooks[$tag] = $callback;
4668
		if ( !in_array( $tag, $this->mStripList ) ) {
4669
			$this->mStripList[] = $tag;
4670
		}
4671
4672
		return $oldVal;
4673
	}
4674
4675
	/**
4676
	 * As setHook(), but letting the contents be parsed.
@@ 4807-4821 (lines=15) @@
4804
	 * @throws MWException
4805
	 * @return null
4806
	 */
4807
	public function setFunctionTagHook( $tag, $callback, $flags ) {
4808
		$tag = strtolower( $tag );
4809
		if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
4810
			throw new MWException( "Invalid character {$m[0]} in setFunctionTagHook('$tag', ...) call" );
4811
		}
4812
		$old = isset( $this->mFunctionTagHooks[$tag] ) ?
4813
			$this->mFunctionTagHooks[$tag] : null;
4814
		$this->mFunctionTagHooks[$tag] = [ $callback, $flags ];
4815
4816
		if ( !in_array( $tag, $this->mStripList ) ) {
4817
			$this->mStripList[] = $tag;
4818
		}
4819
4820
		return $old;
4821
	}
4822
4823
	/**
4824
	 * Replace "<!--LINK-->" link placeholders with actual links, in the buffer