MediaWiki
REL1_31
RegexlikeReplacer.php
Go to the documentation of this file.
1
<?php
24
class
RegexlikeReplacer
extends
Replacer
{
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
}
$matches
$matches
Definition
NoLocalSettings.php:24
RegexlikeReplacer
Class to replace regex matches with a string similar to that used in preg_replace()
Definition
RegexlikeReplacer.php:24
RegexlikeReplacer\replace
replace(array $matches)
Definition
RegexlikeReplacer.php:38
RegexlikeReplacer\$r
$r
Definition
RegexlikeReplacer.php:25
RegexlikeReplacer\__construct
__construct( $r)
Definition
RegexlikeReplacer.php:30
Replacer
Base class for "replacers", objects used in preg_replace_callback() and StringUtils::delimiterReplace...
Definition
Replacer.php:25
includes
libs
replacers
RegexlikeReplacer.php
Generated on Mon Nov 25 2024 15:35:04 for MediaWiki by
1.10.0