Merge pull request #5035 from TeNNoX/master
[civicrm-core.git] / api / v3 / examples / Setting / GetAllDomains.php
index 0a62bf56ed4dd3e3989771b20ec8508cd066c453..311f2b42a8e6c8ee05b7f537c9afeb1af364d837 100644 (file)
@@ -1,58 +1,75 @@
 <?php
 /**
- * Test Generated example of using setting Get API
- * shows getting a variable for all domains *
+ * @file
+ * Test Generated API Example.
+ * See bottom of this file for more detail.
  */
-function setting_get_example(){
-$params = array(
-  'domain_id' => 'all',
-  'return' => 'uniq_email_per_site',
-);
 
-try{
-  $result = civicrm_api3('setting', 'Get', $params);
-}
-catch (CiviCRM_API3_Exception $e) {
-  // handle error here
-  $errorMessage = $e->getMessage();
-  $errorCode = $e->getErrorCode();
-  $errorData = $e->getExtraParams();
-  return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
-}
+/**
+ * Test Generated example of using setting Get API.
+ *
+ * shows getting a variable for all domains
+ *
+ * @return array
+ *   API result array
+ */
+function setting_get_example() {
+  $params = array(
+    'domain_id' => 'all',
+    'return' => 'uniq_email_per_site',
+  );
 
-return $result;
+  try{
+    $result = civicrm_api3('setting', 'Get', $params);
+  }
+  catch (CiviCRM_API3_Exception $e) {
+    // Handle error here.
+    $errorMessage = $e->getMessage();
+    $errorCode = $e->getErrorCode();
+    $errorData = $e->getExtraParams();
+    return array(
+      'error' => $errorMessage,
+      'error_code' => $errorCode,
+      'error_data' => $errorData,
+    );
+  }
+
+  return $result;
 }
 
 /**
- * Function returns array of result expected from previous function
+ * Function returns array of result expected from previous function.
+ *
+ * @return array
+ *   API result array
  */
-function setting_get_expectedresult(){
+function setting_get_expectedresult() {
 
   $expectedResult = array(
-  'is_error' => 0,
-  'version' => 3,
-  'count' => 3,
-  'values' => array(
+    'is_error' => 0,
+    'version' => 3,
+    'count' => 3,
+    'values' => array(
       '1' => array(
-          'uniq_email_per_site' => '1',
-        ),
+        'uniq_email_per_site' => '1',
+      ),
       '2' => array(
-          'uniq_email_per_site' => '1',
-        ),
+        'uniq_email_per_site' => '1',
+      ),
       '3' => array(
-          'uniq_email_per_site' => '1',
-        ),
+        'uniq_email_per_site' => '1',
+      ),
     ),
-);
+  );
 
   return $expectedResult;
 }
 
-
-/*
-* This example has been generated from the API test suite. The test that created it is called
-*
-* testCreateSettingMultipleDomains and can be found in
+/**
+* This example has been generated from the API test suite.
+* The test that created it is called
+* testCreateSettingMultipleDomains
+* and can be found in
 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php
 *
 * You can see the outcome of the API tests at