protected function encode($from, $text, $html, $whole = true)
    {
        $html = str_replace($from . ' ', $text . ' ', $html);

        $html = str_replace(' ' . $from, ' ' . $text, $html);

        $html = str_replace('>' . $from, '>' . $text, $html);

        $html = str_replace($from . '<', $text . '<', $html);

        return $whole ? str_replace($from, $text, $html) : $html;
    }