INFRA-132 - Fix spacing of @return tag in comments
[civicrm-core.git] / api / v3 / Case.php
index bd30bd73314055c7ab58220e2e4794c76020fb62..2c50985f6426764b0a55cd62f315649ab3221ceb 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
   +--------------------------------------------------------------------+
-  | CiviCRM version 4.5                                                |
+  | CiviCRM version 4.6                                                |
   +--------------------------------------------------------------------+
   | Copyright CiviCRM LLC (c) 2004-2014                                |
   +--------------------------------------------------------------------+
@@ -40,7 +40,7 @@
 /**
  * Open a new case, add client and manager roles, and add standard timeline
  *
- * @param  array (
+ * @param array (
  * //REQUIRED:
  * 'case_type_id' => int OR
  * 'case_type' => str (provide one or the other)
@@ -57,7 +57,8 @@
  * 'details' => str // html format
  *
  * @throws API_Exception
- * @return array api result array
+ * @return array
+   *   api result array
  *
  * @access public
  * {@getfields case_create}
@@ -130,7 +131,8 @@ function civicrm_api3_case_create($params) {
 /**
  * Adjust Metadata for Get Action
  *
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_case_get_spec(&$params) {
   $params['contact_id']['api.aliases'] = array('client_id');
@@ -140,7 +142,8 @@ function _civicrm_api3_case_get_spec(&$params) {
 /**
  * Adjust Metadata for Create Action
  *
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_case_create_spec(&$params) {
   $params['contact_id']['api.aliases'] = array('client_id');
@@ -161,7 +164,8 @@ function _civicrm_api3_case_create_spec(&$params) {
 /**
  * Adjust Metadata for Update action
  *
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_case_update_spec(&$params) {
   $params['id']['api.required'] = 1;
@@ -170,7 +174,8 @@ function _civicrm_api3_case_update_spec(&$params) {
 /**
  * Adjust Metadata for Delete action
  *
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_case_delete_spec(&$params) {
   $params['id']['api.required'] = 1;
@@ -192,7 +197,9 @@ function _civicrm_api3_case_delete_spec(&$params) {
  * {@getfields case_get}
  *
  * @throws API_Exception
- * @return array (get mode, case_id provided): Array with case details, case roles, case activity ids, (search mode, case_id not provided): Array of cases found@access public
+ * @return array
+   *   (get mode, case_id provided): Array with case details, case roles, case activity ids, (search mode, case_id not provided): Array of cases found
+ * @access public
  * @todo Erik Hommel 16 dec 2010 check if all DB fields are returned
  */
 function civicrm_api3_case_get($params) {
@@ -228,7 +235,7 @@ function civicrm_api3_case_get($params) {
   }
 
   //search by contacts
-  if ($contact = CRM_Utils_Array::value('contact_id', $params)) {
+  if (($contact = CRM_Utils_Array::value('contact_id', $params)) != FALSE) {
     if (!is_numeric($contact)) {
       throw new API_Exception('Invalid parameter: contact_id.  Must provide a numeric value.');
     }
@@ -254,13 +261,13 @@ SELECT DISTINCT case_id
     $options['return'] = array('contacts' => 1, 'activities' => 1);
   }
 
-  $foundcases =  _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Case');
+  $foundcases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Case');
   $cases = array();
   foreach ($foundcases['values'] as $foundcase) {
-      if ($case = _civicrm_api3_case_read($foundcase['id'], $options)) {
-        $cases[$foundcase['id']] = $case;
-      }
+    if ($case = _civicrm_api3_case_read($foundcase['id'], $options)) {
+      $cases[$foundcase['id']] = $case;
     }
+  }
 
   return civicrm_api3_create_success($cases, $params, 'case', 'get');
 }
@@ -282,7 +289,8 @@ function civicrm_api3_case_activity_create($params) {
 
 /**
  * @deprecated api notice
- * @return array of deprecated actions
+ * @return array
+   *   of deprecated actions
  */
 function _civicrm_api3_case_deprecation() {
   return array('activity_create' => 'Case api "activity_create" action is deprecated. Use the activity api instead.');
@@ -291,7 +299,7 @@ function _civicrm_api3_case_deprecation() {
 /**
  * Update a specified case.
  *
- * @param  array (
+ * @param array (
  * //REQUIRED:
  * 'case_id' => int
  *
@@ -301,7 +309,8 @@ function _civicrm_api3_case_deprecation() {
  * 'contact_id' => int // case client
  *
  * @throws API_Exception
- * @return array api result array
+ * @return array
+   *   api result array
  *
  * @access public
  */
@@ -359,7 +368,7 @@ function civicrm_api3_case_update($params) {
 /**
  * Delete a specified case.
  *
- * @param  array (
+ * @param array (
  * //REQUIRED:
  * 'id' => int
  *
@@ -367,7 +376,8 @@ function civicrm_api3_case_update($params) {
  * 'move_to_trash' => bool (defaults to false)
  *
  * @throws API_Exception
- * @return boolean: true if success, else false
+ * @return boolean
+   *   true if success, else false
  * {@getfields case_delete}
  * @access public
  */
@@ -396,11 +406,8 @@ function civicrm_api3_case_delete($params) {
  *
  * @param $options
  *
- * @internal param $params
- *
- * @internal param $options
- *
- * @return array (reference) case object
+ * @return array
+   *   case object
  */
 function _civicrm_api3_case_read($caseId, $options) {
   $return = CRM_Utils_Array::value('return', $options, array());