Short array syntax - auto-convert api dir
[civicrm-core.git] / api / v3 / examples / Mailing / GetTokens.php
index 6ef6552673d7dbceea4a27d88a6941a95c722336..856e27952707b582bc06289722a1e8d4115cabc4 100644 (file)
@@ -9,12 +9,12 @@
  *   API result array
  */
 function mailing_gettokens_example() {
-  $params = array(
-    'entity' => array(
+  $params = [
+    'entity' => [
       '0' => 'Contact',
       '1' => 'Mailing',
-    ),
-  );
+    ],
+  ];
 
   try{
     $result = civicrm_api3('Mailing', 'gettokens', $params);
@@ -24,11 +24,12 @@ function mailing_gettokens_example() {
     $errorMessage = $e->getMessage();
     $errorCode = $e->getErrorCode();
     $errorData = $e->getExtraParams();
-    return array(
-      'error' => $errorMessage,
+    return [
+      'is_error' => 1,
+      'error_message' => $errorMessage,
       'error_code' => $errorCode,
       'error_data' => $errorData,
-    );
+    ];
   }
 
   return $result;
@@ -42,11 +43,11 @@ function mailing_gettokens_example() {
  */
 function mailing_gettokens_expectedresult() {
 
-  $expectedResult = array(
+  $expectedResult = [
     'is_error' => 0,
     'version' => 3,
     'count' => 82,
-    'values' => array(
+    'values' => [
       '{action.unsubscribe}' => 'Unsubscribe via email',
       '{action.unsubscribeUrl}' => 'Unsubscribe via web page',
       '{action.resubscribe}' => 'Resubscribe via email',
@@ -106,6 +107,7 @@ function mailing_gettokens_expectedresult() {
       '{contact.street_unit}' => 'Street Unit',
       '{contact.supplemental_address_1}' => 'Supplemental Address 1',
       '{contact.supplemental_address_2}' => 'Supplemental Address 2',
+      '{contact.supplemental_address_3}' => 'Supplemental Address 3',
       '{contact.city}' => 'City',
       '{contact.postal_code_suffix}' => 'Postal Code Suffix',
       '{contact.postal_code}' => 'Postal Code',
@@ -129,8 +131,8 @@ function mailing_gettokens_expectedresult() {
       '{contact.url}' => 'Website',
       '{contact.checksum}' => 'Checksum',
       '{contact.contact_id}' => 'Internal Contact ID',
-    ),
-  );
+    ],
+  ];
 
   return $expectedResult;
 }