From 80f3021c74cc4747bad3f42892b5e58a00fe7313 Mon Sep 17 00:00:00 2001 From: Supanut Apikulvanich Date: Fri, 12 Oct 2018 17:21:58 +0700 Subject: [PATCH] Update examples --- examples/execute-sdk.php | 19 ++++++++----------- examples/index.php | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/examples/execute-sdk.php b/examples/execute-sdk.php index 9852071..c33a918 100644 --- a/examples/execute-sdk.php +++ b/examples/execute-sdk.php @@ -1,17 +1,14 @@ $_ENV["TEST_SECRET_TOKEN"], "endpointBase" => $_ENV["TEST_API_URL"] // as optional ]); -function jsonRemoveUnicodeSequences($struct) { - return preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", json_encode($struct, JSON_PRETTY_PRINT)); -} - $applicationId = ''; $NEWLINE = "\n"; $APP_DATA = json_decode(file_get_contents("data.json"), false); @@ -26,13 +23,13 @@ function jsonRemoveUnicodeSequences($struct) { echo $NEWLINE; echo '[create]'.$NEWLINE; -echo jsonRemoveUnicodeSequences($resp).$NEWLINE; +echo jsonRemoveUnicodeSequences($resp, true).$NEWLINE; echo '-------------------------------'.$NEWLINE; $applicationId = $resp->data->id; $resp = $acrosureClient->getApplicationManager()->getPackages($applicationId); echo $NEWLINE; echo '[get-packages]'.$NEWLINE; -echo jsonRemoveUnicodeSequences($resp).$NEWLINE; +echo jsonRemoveUnicodeSequences($resp, true).$NEWLINE; echo '-------------------------------'.$NEWLINE; $packageCode = $resp->data[0]->package_code; $resp = $acrosureClient->getApplicationManager()->selectPackage([ @@ -41,7 +38,7 @@ function jsonRemoveUnicodeSequences($struct) { ]); echo $NEWLINE; echo '[select-package]'.$NEWLINE; -echo jsonRemoveUnicodeSequences($resp).$NEWLINE; +echo jsonRemoveUnicodeSequences($resp, true).$NEWLINE; echo '-------------------------------'.$NEWLINE; $resp = $acrosureClient->getApplicationManager()->update([ "application_id" => $applicationId, @@ -51,13 +48,13 @@ function jsonRemoveUnicodeSequences($struct) { ]); echo $NEWLINE; echo "[update]".$NEWLINE; -echo jsonRemoveUnicodeSequences($resp).$NEWLINE; +echo jsonRemoveUnicodeSequences($resp, true).$NEWLINE; echo '-------------------------------'.$NEWLINE; $resp = $acrosureClient->getApplicationManager()->confirm($applicationId); echo $NEWLINE; echo '[confirm]'.$NEWLINE; -echo jsonRemoveUnicodeSequences($resp).$NEWLINE; +echo jsonRemoveUnicodeSequences($resp, true).$NEWLINE; echo '==============================='.$NEWLINE; -echo jsonRemoveUnicodeSequences($resp).$NEWLINE; +echo jsonRemoveUnicodeSequences($resp, true).$NEWLINE; echo '=============== DONE ==================='.$NEWLINE; ?> diff --git a/examples/index.php b/examples/index.php index 7fb7078..a679a0d 100644 --- a/examples/index.php +++ b/examples/index.php @@ -1 +1 @@ -TEST SDK \ No newline at end of file +TEST SDK