* API result array
*/
function mailing_gettokens_example() {
- $params = array(
- 'entity' => array(
+ $params = [
+ 'entity' => [
'0' => 'Contact',
'1' => 'Mailing',
- ),
- );
+ ],
+ ];
try{
$result = civicrm_api3('Mailing', 'gettokens', $params);
$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;
*/
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',
'{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',
'{contact.url}' => 'Website',
'{contact.checksum}' => 'Checksum',
'{contact.contact_id}' => 'Internal Contact ID',
- ),
- );
+ ],
+ ];
return $expectedResult;
}