mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Fix various code.
This commit is contained in:
@@ -31,6 +31,8 @@ use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use JsonException;
|
||||
|
||||
use function Safe\json_decode;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
*/
|
||||
@@ -100,7 +102,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
$body = (string) $res->getBody();
|
||||
|
||||
try {
|
||||
$json = \Safe\json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException) {
|
||||
Log::error('Body is not valid JSON');
|
||||
Log::error($body);
|
||||
@@ -118,7 +120,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
// parse response a bit. No message yet.
|
||||
$response = $json['firefly_iii'][$channel];
|
||||
$date = Carbon::createFromFormat('Y-m-d', $response['date']);
|
||||
if (null === $date) {
|
||||
if (!$date instanceof Carbon) {
|
||||
$date = today(config('app.timezone'));
|
||||
}
|
||||
$return['version'] = $response['version'];
|
||||
|
Reference in New Issue
Block a user