Merge pull request #15199 from civicrm/5.17
[civicrm-core.git] / api / v3 / examples / GroupContact / Create.php
index 6c0b3ec50a2fbbd79ecb291b6374cb10fd4655fe..afb9496b78898a2d0a07dd0375353bc1505bcc4b 100644 (file)
@@ -6,11 +6,11 @@
  *   API result array
  */
 function group_contact_create_example() {
-  $params = array(
+  $params = [
     'contact_id' => 8,
     'contact_id.2' => 9,
     'group_id' => 11,
-  );
+  ];
 
   try{
     $result = civicrm_api3('GroupContact', 'create', $params);
@@ -20,11 +20,12 @@ function group_contact_create_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;
@@ -38,7 +39,7 @@ function group_contact_create_example() {
  */
 function group_contact_create_expectedresult() {
 
-  $expectedResult = array(
+  $expectedResult = [
     'is_error' => 0,
     'version' => 3,
     'count' => 1,
@@ -46,7 +47,7 @@ function group_contact_create_expectedresult() {
     'total_count' => 2,
     'added' => 1,
     'not_added' => 1,
-  );
+  ];
 
   return $expectedResult;
 }
@@ -58,17 +59,17 @@ function group_contact_create_expectedresult() {
 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php
 *
 * You can see the outcome of the API tests at
-* https://test.civicrm.org/job/CiviCRM-master-git/
+* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
 *
 * To Learn about the API read
-* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
+* https://docs.civicrm.org/dev/en/latest/api/
 *
-* Browse the api on your own site with the api explorer
-* http://MYSITE.ORG/path/to/civicrm/api
+* Browse the API on your own site with the API Explorer. It is in the main
+* CiviCRM menu, under: Support > Development > API Explorer.
 *
 * Read more about testing here
-* http://wiki.civicrm.org/confluence/display/CRM/Testing
+* https://docs.civicrm.org/dev/en/latest/testing/
 *
 * API Standards documentation:
-* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
+* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
 */