73 lines
2.9 KiB
YAML
73 lines
2.9 KiB
YAML
|
name: Escaper
|
||
|
class_comment: '# * Escaper encapsulates escaping rules for single and double-quoted
|
||
|
|
||
|
# * YAML strings.
|
||
|
|
||
|
# *
|
||
|
|
||
|
# * @author Matthew Lewinski <matthew@lewinski.org>
|
||
|
|
||
|
# *
|
||
|
|
||
|
# * @internal'
|
||
|
dependencies: []
|
||
|
properties: []
|
||
|
methods:
|
||
|
- name: requiresDoubleQuoting
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: value
|
||
|
comment: "# * Escaper encapsulates escaping rules for single and double-quoted\n\
|
||
|
# * YAML strings.\n# *\n# * @author Matthew Lewinski <matthew@lewinski.org>\n\
|
||
|
# *\n# * @internal\n# */\n# class Escaper\n# {\n# // Characters that would cause\
|
||
|
\ a dumped string to require double quoting.\n# public const REGEX_CHARACTER_TO_ESCAPE\
|
||
|
\ = \"[\\\\x00-\\\\x1f]|\\x7f|\\xc2\\x85|\\xc2\\xa0|\\xe2\\x80\\xa8|\\xe2\\x80\\\
|
||
|
xa9\";\n# \n# // Mapping arrays for escaping a double quoted string. The backslash\
|
||
|
\ is\n# // first to ensure proper escaping because str_replace operates iteratively\n\
|
||
|
# // on the input arrays. This ordering of the characters avoids the use of strtr,\n\
|
||
|
# // which performs more slowly.\n# private const ESCAPEES = ['\\\\', '\\\\\\\\\
|
||
|
', '\\\\\"', '\"',\n# \"\\x00\", \"\\x01\", \"\\x02\", \"\\x03\", \"\\x04\"\
|
||
|
, \"\\x05\", \"\\x06\", \"\\x07\",\n# \"\\x08\", \"\\x09\", \"\\x0a\", \"\
|
||
|
\\x0b\", \"\\x0c\", \"\\x0d\", \"\\x0e\", \"\\x0f\",\n# \"\\x10\", \"\\x11\"\
|
||
|
, \"\\x12\", \"\\x13\", \"\\x14\", \"\\x15\", \"\\x16\", \"\\x17\",\n# \"\
|
||
|
\\x18\", \"\\x19\", \"\\x1a\", \"\\x1b\", \"\\x1c\", \"\\x1d\", \"\\x1e\"\
|
||
|
, \"\\x1f\",\n# \"\\x7f\",\n# \"\\xc2\\x85\", \"\\xc2\\xa0\", \"\\xe2\\x80\\\
|
||
|
xa8\", \"\\xe2\\x80\\xa9\",\n# ];\n# private const ESCAPED = ['\\\\\\\\', '\\\\\
|
||
|
\"', '\\\\\\\\', '\\\\\"',\n# '\\\\0', '\\\\x01', '\\\\x02', '\\\\x03', '\\\\\
|
||
|
x04', '\\\\x05', '\\\\x06', '\\\\a',\n# '\\\\b', '\\\\t', '\\\\n', '\\\\\
|
||
|
v', '\\\\f', '\\\\r', '\\\\x0e', '\\\\x0f',\n# '\\\\x10', '\\\\x11', '\\\
|
||
|
\\x12', '\\\\x13', '\\\\x14', '\\\\x15', '\\\\x16', '\\\\x17',\n# '\\\\x18', '\\\
|
||
|
\\x19', '\\\\x1a', '\\\\e', '\\\\x1c', '\\\\x1d', '\\\\x1e', '\\\\x1f',\n# '\\\
|
||
|
\\x7f',\n# '\\\\N', '\\\\_', '\\\\L', '\\\\P',\n# ];\n# \n# /**\n# * Determines\
|
||
|
\ if a PHP value would require double quoting in YAML.\n# *\n# * @param string\
|
||
|
\ $value A PHP value"
|
||
|
- name: escapeWithDoubleQuotes
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: value
|
||
|
comment: '# * Escapes and surrounds a PHP value with double quotes.
|
||
|
|
||
|
# *
|
||
|
|
||
|
# * @param string $value A PHP value'
|
||
|
- name: requiresSingleQuoting
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: value
|
||
|
comment: '# * Determines if a PHP value would require single quoting in YAML.
|
||
|
|
||
|
# *
|
||
|
|
||
|
# * @param string $value A PHP value'
|
||
|
- name: escapeWithSingleQuotes
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: value
|
||
|
comment: '# * Escapes and surrounds a PHP value with single quotes.
|
||
|
|
||
|
# *
|
||
|
|
||
|
# * @param string $value A PHP value'
|
||
|
traits: []
|
||
|
interfaces: []
|