From 8b3dab748d993097316d001382c83f5ec25b3478 Mon Sep 17 00:00:00 2001 From: kaioken Date: Tue, 17 May 2022 19:30:30 -0400 Subject: [PATCH] hotfix : isJson Null --- src/functions.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/functions.php b/src/functions.php index de86a514..f827a236 100644 --- a/src/functions.php +++ b/src/functions.php @@ -41,7 +41,7 @@ function appPath(string $path = '') : string $currentDir = basePath() . ($path ? DIRECTORY_SEPARATOR . $path : $path); /** - * since we are calling this file from the diferent path we have to verify if its cli. + * since we are calling this file from the different path we have to verify if its cli. * * @todo look for a better solution , hate this */ @@ -103,9 +103,9 @@ function appUrl(string $resource, int $recordId) if (!function_exists('Baka\paymentGatewayIsActive')) { /** - * Do we have a payment metho actived on the app? + * Do we have a payment method active on the app? * - * @return boolean + * @return bool */ function paymentGatewayIsActive() : bool { @@ -119,10 +119,14 @@ function paymentGatewayIsActive() : bool * * @param string $string * - * @return boolean + * @return bool */ - function isJson(string $string) : bool + function isJson(?string $string = null) : bool { + if ($string === null) { + return false; + } + try { json_decode($string); return true; @@ -150,7 +154,7 @@ function json_decode(string $json) /** * Are we running a Swoole Server for this app? * - * @return boolean + * @return bool */ function isSwooleServer() : bool { @@ -162,7 +166,7 @@ function isSwooleServer() : bool /** * Are we running a Swoole Server for this app? * - * @return boolean + * @return string */ function getShortClassName(object $object) : string {