Short array syntax - auto-convert api dir
[civicrm-core.git] / api / v3 / examples / Contribution / ContributionCreateWithSoftCredit.php
index a798c940b10f96510fbd7cf23ae5b1229f3b717e..e8f3cf62b44f8637bda0bd3a9c5b343840fc1929 100644 (file)
@@ -8,7 +8,7 @@
  *   API result array
  */
 function contribution_create_example() {
-  $params = array(
+  $params = [
     'contact_id' => 24,
     'receive_date' => '20120511',
     'total_amount' => '100',
@@ -18,14 +18,14 @@ function contribution_create_example() {
     'net_amount' => '95',
     'source' => 'SSF',
     'contribution_status_id' => 1,
-    'soft_credit' => array(
-      '1' => array(
+    'soft_credit' => [
+      '1' => [
         'contact_id' => 25,
         'amount' => 50,
         'soft_credit_type_id' => 3,
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   try{
     $result = civicrm_api3('Contribution', 'create', $params);
@@ -35,12 +35,12 @@ function contribution_create_example() {
     $errorMessage = $e->getMessage();
     $errorCode = $e->getErrorCode();
     $errorData = $e->getExtraParams();
-    return array(
+    return [
       'is_error' => 1,
       'error_message' => $errorMessage,
       'error_code' => $errorCode,
       'error_data' => $errorData,
-    );
+    ];
   }
 
   return $result;
@@ -54,13 +54,13 @@ function contribution_create_example() {
  */
 function contribution_create_expectedresult() {
 
-  $expectedResult = array(
+  $expectedResult = [
     'is_error' => 0,
     'version' => 3,
     'count' => 1,
     'id' => 1,
-    'values' => array(
-      '1' => array(
+    'values' => [
+      '1' => [
         'id' => '1',
         'contact_id' => '24',
         'financial_type_id' => '1',
@@ -91,9 +91,9 @@ function contribution_create_expectedresult() {
         'tax_amount' => '',
         'revenue_recognition_date' => '',
         'contribution_type_id' => '1',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   return $expectedResult;
 }