Skip to content

Commit

Permalink
Run rector with additional rules
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredup committed Nov 7, 2023
1 parent 8f78e53 commit dd2aa53
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Action/CaptureOffsiteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function execute($request)
if (isset($httpRequest->query['EXECCODE'])) {
$model->replace($httpRequest->query);
} else {
$extradata = $model['EXTRADATA'] ? json_decode($model['EXTRADATA'], true) : [];
$extradata = $model['EXTRADATA'] ? json_decode($model['EXTRADATA'], true, 512, JSON_THROW_ON_ERROR) : [];

if (false == isset($extradata['capture_token']) && $request->getToken()) {
$extradata['capture_token'] = $request->getToken()->getHash();
Expand All @@ -62,7 +62,7 @@ public function execute($request)
$extradata['notify_token'] = $notifyToken->getHash();
}

$model['EXTRADATA'] = json_encode($extradata);
$model['EXTRADATA'] = json_encode($extradata, JSON_THROW_ON_ERROR);

throw new HttpPostRedirect(
$this->api->getOffsiteUrl(),
Expand Down
2 changes: 1 addition & 1 deletion Action/CaptureOffsiteNullAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function execute($request)
}

$extraDataJson = $httpRequest->query['EXTRADATA'];
if (false == $extraData = json_decode($extraDataJson, true)) {
if (false == $extraData = json_decode($extraDataJson, true, 512, JSON_THROW_ON_ERROR)) {
throw new HttpResponse('The capture is invalid. Code Be2Bell2', 400);
}

Expand Down
2 changes: 1 addition & 1 deletion Action/NotifyNullAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function execute($request)
}

$extraDataJson = $httpRequest->query['EXTRADATA'];
if (false == $extraData = json_decode($extraDataJson, true)) {
if (false == $extraData = json_decode($extraDataJson, true, 512, JSON_THROW_ON_ERROR)) {
throw new HttpResponse('The notification is invalid. Code Be2Bell2', 400);
}

Expand Down
2 changes: 1 addition & 1 deletion Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ protected function doRequest(array $fields)
throw HttpException::factory($request, $response);
}

$result = json_decode($response->getBody()->getContents());
$result = json_decode($response->getBody()->getContents(), null, 512, JSON_THROW_ON_ERROR);
if (null === $result) {
throw new LogicException("Response content is not valid json: \n\n{$response->getBody()->getContents()}");
}
Expand Down

0 comments on commit dd2aa53

Please sign in to comment.