src/SWP/Behat/Contexts/WebhookContext.php 1 location
|
@@ 30-38 (lines=9) @@
|
| 27 |
|
} |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
private function normalizeJson(string $value): string |
| 31 |
|
{ |
| 32 |
|
$value = \json_decode($value, true); |
| 33 |
|
if (JSON_ERROR_NONE !== \json_last_error()) { |
| 34 |
|
throw new \Exception("The string '$value' is not valid json"); |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
return \json_encode($value); |
| 38 |
|
} |
| 39 |
|
} |
| 40 |
|
|
src/SWP/Bundle/CoreBundle/Controller/ExternalDataController.php 1 location
|
@@ 120-128 (lines=9) @@
|
| 117 |
|
return new SingleResourceResponse($responseData, new ResponseContext(200)); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
private static function getArrayFromJson($jsonString) |
| 121 |
|
{ |
| 122 |
|
$jsonArray = \json_decode($jsonString, true); |
| 123 |
|
if (is_null($jsonArray) || JSON_ERROR_NONE !== \json_last_error()) { |
| 124 |
|
throw new InvalidDataException('Provided request content is not valid JSON'); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
return $jsonArray; |
| 128 |
|
} |
| 129 |
|
} |
| 130 |
|
|