If true, greater than will be escaped as "\u003E" and less than as
"\u003C".
By default, greater than/less than symbols are not escaped.
public setEscapeGtLt ( boolean $enabled ) | ||
$enabled | boolean | Whether greater than/less than should be escaped |
public function testGtLtNotEscaoed() { $this->encoder->setEscapeGtLt(false); $this->assertSame('"<>"', $this->encoder->encode('<>')); }
public function __construct($path, $flags = 0) { Assert::string($path, 'The path must be a string. Got: %s'); Assert::notEmpty($path, 'The path must not be empty.'); Assert::integer($flags, 'The flags must be an integer. Got: %s'); $this->path = $path; $this->flags = $flags; $this->encoder = new JsonEncoder(); $this->encoder->setEscapeGtLt($this->flags & self::ESCAPE_GT_LT); $this->encoder->setEscapeAmpersand($this->flags & self::ESCAPE_AMPERSAND); $this->encoder->setEscapeSingleQuote($this->flags & self::ESCAPE_SINGLE_QUOTE); $this->encoder->setEscapeDoubleQuote($this->flags & self::ESCAPE_DOUBLE_QUOTE); $this->encoder->setEscapeSlash(!($this->flags & self::NO_ESCAPE_SLASH)); $this->encoder->setEscapeUnicode(!($this->flags & self::NO_ESCAPE_UNICODE)); $this->encoder->setPrettyPrinting($this->flags & self::PRETTY_PRINT); $this->encoder->setTerminateWithLineFeed($this->flags & self::TERMINATE_WITH_LINE_FEED); $this->decoder = new JsonDecoder(); $this->decoder->setObjectDecoding(JsonDecoder::ASSOC_ARRAY); }