Automattic\WooCommerce\EmailEditorVendor\Pelago\Emogrifier\Utilities
Preg::replaceCallback
Wraps preg_replace_callback, though does not support $subject being an array. If an error occurs, and exceptions are not being thrown, the original $subject is returned.
Note that (unlike when calling preg_replace_callback), $callback cannot be a non-public method represented by an array comprising an object or class name and the method name. To circumvent that, use \Closure::fromCallable([$objectOrClassName, 'method']).
Метод класса: Preg{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Preg = new Preg(); $Preg->replaceCallback( $pattern, $callback, $subject, $limit, ?int $count ): string;
- $pattern(non-empty-string|non-empty-array
) (обязательный) - .
- $callback(callable) (обязательный)
- .
- $subject(строка) (обязательный)
- .
- $limit(int)
- .
По умолчанию:-1 - ?int $count(передается по ссылке — &)
- .
По умолчанию:null
Код Preg::replaceCallback() Preg::replaceCallback WC 11.3.0
public function replaceCallback(
$pattern,
callable $callback,
string $subject,
int $limit = -1,
?int &$count = null
): string {
$result = \preg_replace_callback($pattern, $callback, $subject, $limit, $count);
if ($result === null) {
$this->logOrThrowPregLastError();
$result = $subject;
}
return $result;
}