From 65e61bdff24bd45629c918dfef9b3b07b84ca3a1 Mon Sep 17 00:00:00 2001 From: Jonathan Maron Date: Tue, 22 Aug 2017 07:20:50 +0200 Subject: [PATCH] Improved code formatting quality --- demo/convert-document.php | 4 ---- demo/find-and-replace-document.php | 19 ++++++++----------- demo/merge-document-advanced.php | 25 +++++++++++-------------- demo/template-management.php | 10 ---------- 4 files changed, 19 insertions(+), 39 deletions(-) diff --git a/demo/convert-document.php b/demo/convert-document.php index 588ba2a4..9b91129c 100644 --- a/demo/convert-document.php +++ b/demo/convert-document.php @@ -21,14 +21,10 @@ $binaryData = $reportingCloud->convertDocument($sourceFilename, 'PDF'); if ($binaryData) { - var_dump("{$sourceFilename} was converted"); - file_put_contents($destinationFilename, $binaryData); - var_dump("And written to {$destinationFilename}"); } else { - var_dump("Error converting {$sourceFilename}"); } diff --git a/demo/find-and-replace-document.php b/demo/find-and-replace-document.php index 141003d8..2ffb60ce 100644 --- a/demo/find-and-replace-document.php +++ b/demo/find-and-replace-document.php @@ -20,21 +20,18 @@ ]; $mergeSettings = [ - - 'creation_date' => time(), - 'last_modification_date' => time(), - + 'author' => 'James Henry Trotter', + 'creation_date' => time(), + 'creator_application' => 'The Giant Peach', + 'document_subject' => 'The Old Green Grasshopper', + 'document_title' => 'James and the Giant Peach', + 'last_modification_date' => time(), + 'merge_html' => false, 'remove_empty_blocks' => true, 'remove_empty_fields' => true, 'remove_empty_images' => true, 'remove_trailing_whitespace' => true, - - 'author' => 'James Henry Trotter', - 'creator_application' => 'The Giant Peach', - 'document_subject' => 'The Old Green Grasshopper', - 'document_title' => 'James and the Giant Peach', - - 'user_password' => '1', + 'user_password' => '1', ]; $binaryData = $reportingCloud->findAndReplaceDocument($findAndReplaceData, 'PDF', null, $sourceFilename, $mergeSettings); diff --git a/demo/merge-document-advanced.php b/demo/merge-document-advanced.php index 89b0611c..19799985 100644 --- a/demo/merge-document-advanced.php +++ b/demo/merge-document-advanced.php @@ -14,7 +14,7 @@ // --------------------------------------------------------------------------------------------------------------------- $mergeData = [ - 0 => [ + [ 'yourcompany_companyname' => 'Text Control, LLC', 'yourcompany_zip' => '28226', 'yourcompany_city' => 'Charlotte', @@ -44,7 +44,7 @@ 'recipient_street' => '1 Washington Dr', 'recipient_phone' => '887 267 3356', 'item' => [ - 0 => [ + [ 'qty' => '1', 'item_no' => '1', 'item_description' => 'Item description 1', @@ -52,7 +52,7 @@ 'item_discount' => '20', 'item_total' => '2130.40', ], - 1 => [ + [ 'qty' => '1', 'item_no' => '2', 'item_description' => 'Item description 2', @@ -110,21 +110,18 @@ // mergeSettings are set $mergeSettings = [ - - 'creation_date' => time(), - 'last_modification_date' => time(), - + 'author' => 'James Henry Trotter', + 'creation_date' => time(), + 'creator_application' => 'The Giant Peach', + 'document_subject' => 'The Old Green Grasshopper', + 'document_title' => 'James and the Giant Peach', + 'last_modification_date' => time(), + 'merge_html' => false, 'remove_empty_blocks' => true, 'remove_empty_fields' => true, 'remove_empty_images' => true, 'remove_trailing_whitespace' => true, - - 'author' => 'James Henry Trotter', - 'creator_application' => 'The Giant Peach', - 'document_subject' => 'The Old Green Grasshopper', - 'document_title' => 'James and the Giant Peach', - - 'user_password' => '1', + 'user_password' => '1', ]; $sourceFilename = REPORTING_CLOUD_DEMO_MEDIA_PATH . '/test_template.tx'; diff --git a/demo/template-management.php b/demo/template-management.php index 9eb043f6..35786cf4 100644 --- a/demo/template-management.php +++ b/demo/template-management.php @@ -23,14 +23,10 @@ // Uploaded, if it is not if (!$reportingCloud->templateExists($templateName)) { - var_dump("{$templateName} is not in template storage"); - if ($reportingCloud->uploadTemplate($sourceFilename)) { - var_dump("Uploaded {$sourceFilename}"); } else { - var_dump("Error uploading {$sourceFilename}"); } } @@ -50,14 +46,10 @@ $binaryData = $reportingCloud->downloadTemplate($templateName); if ($binaryData) { - var_dump("{$templateName} was downloaded"); - file_put_contents($destinationFilename, $binaryData); - var_dump("{$templateName} was written to {$destinationFilename}"); } else { - var_dump("Error downloading {$templateName}"); } @@ -90,10 +82,8 @@ // Delete a template in template storage if ($reportingCloud->deleteTemplate($templateName)) { - var_dump("{$templateName} was deleted"); } else { - var_dump("Error deleting {$templateName}"); }