INFRA-132 - Fix spacing of @return tag in comments
[civicrm-core.git] / api / v3 / Generic.php
index 362c1c438865bbeb682970a59a83582f95d02c61..99e6274bd528e38a980410aa5f0880348900c112 100644 (file)
@@ -17,7 +17,8 @@
  *  - version: string
  *  - function: callback (mixed)
  *  - params: array, varies
- *  @return array API success object
+ * @return array
+   *   API success object
  */
 function civicrm_api3_generic_getfields($apiRequest) {
   static $results = array();
@@ -25,12 +26,12 @@ function civicrm_api3_generic_getfields($apiRequest) {
     $results = array();
     // we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes
     CRM_Core_PseudoConstant::flush();
-    if (!empty($apiRequest['params']['fieldname'])){
+    if (!empty($apiRequest['params']['fieldname'])) {
       CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']);
     }
-    if (!empty($apiRequest['params']['option_group_id'])){
-      $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name') );
-      if (is_string($optionGroupName)){
+    if (!empty($apiRequest['params']['option_group_id'])) {
+      $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name'));
+      if (is_string($optionGroupName)) {
         CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName));
       }
     }
@@ -63,7 +64,7 @@ function civicrm_api3_generic_getfields($apiRequest) {
     case 'getsingle':
     case 'getcount':
       $metadata = _civicrm_api_get_fields($apiRequest['entity'], $unique, $apiRequest['params']);
-      if (empty($metadata['id'])){
+      if (empty($metadata['id'])) {
         // if id is not set we will set it eg. 'id' from 'case_id', case_id will be an alias
         if (!empty($metadata[strtolower($apiRequest['entity']) . '_id'])) {
           $metadata['id'] = $metadata[$lcase_entity . '_id'];
@@ -71,7 +72,7 @@ function civicrm_api3_generic_getfields($apiRequest) {
           $metadata['id']['api.aliases'] = array($lcase_entity . '_id');
         }
       }
-      else{
+      else {
         // really the preference would be to set the unique name in the xml
         // question is which is a less risky fix this close to a release - setting in xml for the known failure
         // (note) or setting for all api where fields is returning 'id' & we want to accept 'note_id' @ the api layer
@@ -104,7 +105,8 @@ function civicrm_api3_generic_getfields($apiRequest) {
           'title' => 'Context',
         ),
       );
-        break;
+      break;
+
     default:
       // oddballs are on their own
       $metadata = array();
@@ -147,12 +149,13 @@ function civicrm_api3_generic_getfields($apiRequest) {
  *   Api request as an array. Keys are.
  *
  * @throws API_Exception
- * @return integer count of results
+ * @return integer
+   *   count of results
  */
 function civicrm_api3_generic_getcount($apiRequest) {
   $apiRequest['params']['options']['is_count'] = TRUE;
   $result = civicrm_api($apiRequest['entity'], 'get', $apiRequest['params']);
-  if (is_numeric (CRM_Utils_Array::value('values', $result))) {
+  if (is_numeric(CRM_Utils_Array::value('values', $result))) {
     return (int) $result['values'];
   }
   if (!isset($result['count'])) {
@@ -167,7 +170,8 @@ function civicrm_api3_generic_getcount($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array. Keys are.
  *
- * @return integer count of results
+ * @return integer
+   *   count of results
  */
 function civicrm_api3_generic_getsingle($apiRequest) {
   // so the first entity is always result['values'][0]
@@ -191,7 +195,8 @@ function civicrm_api3_generic_getsingle($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array. Keys are.
  *
- * @return integer count of results
+ * @return integer
+   *   count of results
  */
 function civicrm_api3_generic_getvalue($apiRequest) {
   $apiRequest['params']['sequential'] = 1;
@@ -231,7 +236,8 @@ function _civicrm_api3_generic_getrefcount_spec(&$params) {
  *   Api request as an array.
  *
  * @throws API_Exception
- * @return array API result (int 0 or 1)
+ * @return array
+   *   API result (int 0 or 1)
  */
 function civicrm_api3_generic_getrefcount($apiRequest) {
   $entityToClassMap = CRM_Core_DAO_AllCoreTables::daoToClass();
@@ -257,7 +263,8 @@ function civicrm_api3_generic_getrefcount($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array. Keys are.
  *
- * @return integer count of results
+ * @return integer
+   *   count of results
  */
 function civicrm_api3_generic_replace($apiRequest) {
   return _civicrm_api3_generic_replace($apiRequest['entity'], $apiRequest['params']);
@@ -269,7 +276,8 @@ function civicrm_api3_generic_replace($apiRequest) {
  * @param array $apiRequest
  *   Api request as an array.
  *
- * @return array of results
+ * @return array
+   *   of results
  */
 function civicrm_api3_generic_getoptions($apiRequest) {
   // Resolve aliases
@@ -315,7 +323,7 @@ function civicrm_api3_generic_getoptions($apiRequest) {
  * @param array $fieldsToResolve
  *   Anny field resolutions specifically requested.
  */
-function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fieldname, $fieldSpec, $fieldsToResolve){
+function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fieldname, $fieldSpec, $fieldsToResolve) {
   if (empty($fieldSpec['pseudoconstant']) && empty($fieldSpec['option_group_id'])) {
     return;
   }