Merge pull request #9415 from lcdservices/CRM-19668
[civicrm-core.git] / api / v3 / LocBlock.php
index 0db1cd34925301e8173869907f3e6b6037fec654..2d2544aa18530813db485d7669c740109f49117f 100644 (file)
@@ -25,7 +25,6 @@
  +--------------------------------------------------------------------+
  */
 
-
 /**
  * This api exposes CiviCRM LocBlock records.
  *
@@ -36,7 +35,7 @@
  * Create or update a LocBlock.
  *
  * @param array $params
- *   name/value pairs to insert in new 'LocBlock'
+ *   Name/value pairs to insert in new 'LocBlock'.
  *
  * @return array
  *   API result array.
  */
 function civicrm_api3_loc_block_create($params) {
   $entities = array();
-  civicrm_api3_verify_one_mandatory($params, NULL, array('address', 'address_id', 'phone', 'phone_id', 'im', 'im_id', 'email', 'email_id'));
-  // Call the appropriate api to create entities if any are passed in the params
+  $any_mandatory = array(
+    'address',
+    'address_id',
+    'phone',
+    'phone_id',
+    'im',
+    'im_id',
+    'email',
+    'email_id',
+  );
+  civicrm_api3_verify_one_mandatory($params, NULL, $any_mandatory);
+  // Call the appropriate api to create entities if any are passed in the params.
   // This is basically chaining but in reverse - we create the sub-entities first
-  // This exists because chainging does not work in reverse, or with keys like 'email_2'
+  // because chaining does not work in reverse, or with keys like 'email_2'.
   $items = array('address', 'email', 'phone', 'im');
   foreach ($items as $item) {
     foreach (array('', '_2') as $suf) {
       $key = $item . $suf;
       if (!empty($params[$key]) && is_array($params[$key])) {
         $info = $params[$key];
-        // If all we get is an id don't bother calling the api
+        // If all we get is an id don't bother calling the api.
         if (count($info) == 1 && !empty($info['id'])) {
           $params[$key . '_id'] = $info['id'];
         }
-        // Bother calling the api
+        // Bother calling the api.
         else {
           $info['contact_id'] = CRM_Utils_Array::value('contact_id', $info, 'null');
           $result = civicrm_api3($item, 'create', $info);
@@ -85,7 +94,7 @@ function civicrm_api3_loc_block_create($params) {
  *
  * @param array $params
  *   Array of one or more valid property_name=>value pairs. If $params is set.
- *   as null, all loc_blocks will be returned (default limit is 25)
+ *   as null, all loc_blocks will be returned (default limit is 25).
  *
  * @return array
  *   API result array.
@@ -93,7 +102,7 @@ function civicrm_api3_loc_block_create($params) {
 function civicrm_api3_loc_block_get($params) {
   $options = _civicrm_api3_get_options_from_params($params);
   // If a return param has been set then fetch the appropriate fk objects
-  // This is a helper because api chaining does not work with a key like 'email_2'
+  // This is a helper because api chaining does not work with a key like 'email_2'.
   if (!empty($options['return'])) {
     unset($params['return']);
     $values = array();