Cleans up a String::insert() formatted string with given $options depending
on the 'clean' option. The goal of this function is to replace all whitespace
and unneeded mark-up around place-holders that did not get replaced by String::insert().
public static clean ( string $str, array $options = [] ) : string | ||
$str | string | The string to clean. |
$options | array | Available options are: - `'after'`: characters marking the end of targeted substring. - `'andText'`: (defaults to `true`). - `'before'`: characters marking the start of targeted substring. - `'clean'`: `true` or an array of clean options: - `'gap'`: Regular expression matching gaps. - `'method'`: Either `'text'` or `'html'` (defaults to `'text'`). - `'replacement'`: String to use for cleaned substrings (defaults to `''`). - `'word'`: Regular expression matching words. |
return | string | The cleaned string. |