setEscapeSingleQuote() public method

If true, single quotes will be escaped as "\u0027". By default, single quotes are not escaped.
public setEscapeSingleQuote ( boolean $enabled )
$enabled boolean Whether single quotes should be escaped
示例#1
0
 public function testSingleQuoteNotEscaped()
 {
     $this->encoder->setEscapeSingleQuote(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);
 }