XF 2.2 Censoring words in custom bbcode


I'm looking for a good way to censor words in custom bbcode. Using the Html renderer as an example, I'd normally just want to call $renderer->formatter->censorText() however A) I can't guarantee that exists, as I have an AbstractRenderer and B) it's protected anyway so I don't have access to it. Is there a static that I can call, or some other solution?
I eventually went with what feels like overkill, but:

$censoredValue = $renderer->renderSubTree([$currentStringValue], $options);
Top Bottom