MediaWiki REL1_31
RegexlikeReplacer.php
Go to the documentation of this file.
1<?php
25 private $r;
26
30 public function __construct( $r ) {
31 $this->r = $r;
32 }
33
38 public function replace( array $matches ) {
39 $pairs = [];
40 foreach ( $matches as $i => $match ) {
41 $pairs["\$$i"] = $match;
42 }
43
44 return strtr( $this->r, $pairs );
45 }
46}
Class to replace regex matches with a string similar to that used in preg_replace()
replace(array $matches)
Base class for "replacers", objects used in preg_replace_callback() and StringUtils::delimiterReplace...
Definition Replacer.php:25