Code Duplication    Length = 13-15 lines in 2 locations

includes/parser/Parser.php 2 locations

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