public static function init() { self::$JS_CHARS_ESCAPED = array_fill(0, self::NUMBER_OF_JS_ESCAPED_CHARS, ''); self::$JS_CHARS_ESCAPED[0] = '0'; self::$JS_CHARS_ESCAPED[ord("\\b")] = 'b'; self::$JS_CHARS_ESCAPED[ord("\t")] = 't'; self::$JS_CHARS_ESCAPED[ord("\n")] = 'n'; self::$JS_CHARS_ESCAPED[ord("\f")] = 'f'; self::$JS_CHARS_ESCAPED[ord("\r")] = 'r'; self::$JS_CHARS_ESCAPED[ord(self::JS_ESCAPE_CHAR)] = self::JS_ESCAPE_CHAR; self::$JS_CHARS_ESCAPED[ord(self::JS_QUOTE_CHAR)] = self::JS_QUOTE_CHAR; }
private function append($x) { $this->buffer->append(EscapeUtil::escape($x))->append(RPC_SEPARATOR_CHAR); }
public function endVisitString(StringValueCommand $x, Context $ctx) { if ($this->parent->hasBackRef($x)) { if (!$this->isStarted($x)) { $escaped = EscapeUtil::escape($x->getValue()); $this->push($this->beginValue($x)); $this->eq(); $this->quote(); $this->push($escaped); $this->quote(); $this->commit($x, false); } else { $this->push($this->parent->makeBackRef($x)); } } else { $escaped = EscapeUtil::escape($x->getValue()); $this->quote(); $this->push($escaped); $this->quote(); } }