Thunder\Shortcode\Processor\Processor::applyReplaces PHP Method

applyReplaces() private method

private applyReplaces ( $text, array $replaces )
$replaces array
    private function applyReplaces($text, array $replaces)
    {
        return array_reduce(array_reverse($replaces), function ($state, ReplacedShortcode $s) {
            $offset = $s->getOffset();
            $length = mb_strlen($s->getText(), 'utf-8');
            $textLength = mb_strlen($state, 'utf-8');
            return mb_substr($state, 0, $offset, 'utf-8') . $s->getReplacement() . mb_substr($state, $offset + $length, $textLength, 'utf-8');
        }, $text);
    }