protected function escapeControlCharacters($string)
    {
        $escapedString = $this->escapeEscapeCharacter($string);

        // if no control characters
        if (!preg_match("/{$this->escapableControlCharactersPattern}/", $escapedString)) {
            return $escapedString;
        }

        return preg_replace_callback("/({$this->escapableControlCharactersPattern})/", function($matches) {
            return $this->controlCharactersEscapingReverseMap[$matches[0]];
        }, $escapedString);
    }