* Decode JSON input, supporting both standard and line-delimited JSON. */
(string $rawResult)
| 179 | * Decode JSON input, supporting both standard and line-delimited JSON. |
| 180 | */ |
| 181 | private function decodeJsonInput(string $rawResult) { |
| 182 | $json = json_decode($rawResult, true); |
| 183 | if ($json === null && trim($rawResult) !== '') { |
| 184 | $json = []; |
| 185 | foreach (explode("\n", trim($rawResult)) as $line) { |
| 186 | $decoded = json_decode($line, true); |
| 187 | if ($decoded !== null) { |
| 188 | $json[] = $decoded; |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | return $json; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Extracts fields inside curly braces from the path string. |