1 | <?php |
||
22 | class StringValueBuilder extends BaseBuilder |
||
23 | { |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private const UTF_SEQUENCE_PATTERN = '/(?<!\\\\)\\\\u([0-9a-f]{4})/ui'; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private const CHAR_SEQUENCE_PATTERN = '/(?<!\\\\)\\\\(b|f|n|r|t)/u'; |
||
33 | |||
34 | /** |
||
35 | * @param RuleInterface $rule |
||
36 | * @return bool |
||
37 | */ |
||
38 | public function match(RuleInterface $rule): bool |
||
42 | |||
43 | /** |
||
44 | * @param ContextInterface $ctx |
||
45 | * @param RuleInterface $rule |
||
46 | * @return mixed|Value |
||
47 | */ |
||
48 | public function reduce(ContextInterface $ctx, RuleInterface $rule): ValueInterface |
||
54 | |||
55 | /** |
||
56 | * @param string $value |
||
57 | * @return string |
||
58 | */ |
||
59 | public function parse(string $value): string |
||
75 | |||
76 | /** |
||
77 | * @param string $value |
||
78 | * @return string |
||
79 | */ |
||
80 | private function encodeSlashes(string $value): string |
||
84 | |||
85 | /** |
||
86 | * Method for parsing and decode utf-8 character |
||
87 | * sequences like "\uXXXX" type. |
||
88 | * |
||
89 | * @see http://facebook.github.io/graphql/October2016/#sec-String-Value |
||
90 | * @param string $body |
||
91 | * @return string |
||
92 | */ |
||
93 | private function renderUtfSequences(string $body): string |
||
107 | |||
108 | /** |
||
109 | * @param string $body |
||
110 | * @return string |
||
111 | */ |
||
112 | private function forwardRenderUtfSequences(string $body): string |
||
116 | |||
117 | /** |
||
118 | * @param string $body |
||
119 | * @return string |
||
120 | */ |
||
121 | private function fallbackRenderUtfSequences(string $body): string |
||
135 | |||
136 | /** |
||
137 | * Method for parsing special control characters. |
||
138 | * |
||
139 | * @see http://facebook.github.io/graphql/October2016/#sec-String-Value |
||
140 | * @param string $body |
||
141 | * @return string |
||
142 | */ |
||
143 | private function renderSpecialCharacters(string $body): string |
||
166 | |||
167 | /** |
||
168 | * @param string $value |
||
169 | * @return string |
||
170 | */ |
||
171 | private function decodeSlashes(string $value): string |
||
175 | |||
176 | /** |
||
177 | * @param RuleInterface $rule |
||
178 | * @return string |
||
179 | */ |
||
180 | private function getNativeValue(RuleInterface $rule): string |
||
184 | |||
185 | /** |
||
186 | * @return string |
||
187 | */ |
||
188 | private function getStringValue(): string |
||
195 | } |
||
196 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.