Automattic\WooCommerce\Vendor\Pelago\Emogrifier\Utilities

Preg::splitpublicWC 1.0

Wraps preg_split. If an error occurs, and exceptions are not being thrown, a single-element array containing the original $subject is returned. This method does not support the PREG_SPLIT_OFFSET_CAPTURE flag and will throw an exception if it is specified.

Метод класса: Preg{}

Хуков нет.

Возвращает

Массив. string>

Использование

$Preg = new Preg();
$Preg->split( $pattern, $subject, $limit, $flags ): array;
$pattern(non-empty-string) (обязательный)
.
$subject(строка) (обязательный)
.
$limit(int)
.
По умолчанию: -1
$flags(int)
.

Код Preg::split() WC 10.4.3

public function split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
{
    if (($flags & PREG_SPLIT_OFFSET_CAPTURE) !== 0) {
        throw new \RuntimeException('PREG_SPLIT_OFFSET_CAPTURE is not supported by Preg::split', 1726506348);
    }

    $result = \preg_split($pattern, $subject, $limit, $flags);

    if ($result === false) {
        $this->logOrThrowPregLastError();
        $result = [$subject];
    }

    return $result;
}