From: Eileen McNaughton Date: Mon, 2 Feb 2015 05:22:07 +0000 (+1300) Subject: some more comment fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=61fe4988936f8bb28644451af665a141d6eb4c7b;p=civicrm-core.git some more comment fixes --- diff --git a/api/Exception.php b/api/Exception.php index 8629359f21..406997be46 100644 --- a/api/Exception.php +++ b/api/Exception.php @@ -1,5 +1,6 @@ $activityArray) { $activities[$key]['id'] = $key; } @@ -253,13 +244,14 @@ function civicrm_api3_activity_get($params) { } /** - * Given a list of activities, append any extra data requested about the activities + * Given a list of activities, append any extra data requested about the activities. * * NOTE: Called by civicrm-core and CiviHR * * @param array $params * API request parameters. * @param array $activities + * * @return array * new activities list */ @@ -319,16 +311,10 @@ function _civicrm_api3_activity_get_formatResult($params, $activities) { * * @param array $params * Array holding 'id' of activity to be deleted. - * {@getfields activity_delete} * * @throws API_Exception - * @return void|CRM_Core_Error An error if 'activityName or ID' is invalid, - * permissions are insufficient, etc. or CiviCRM success array - * - * - * - * @example ActivityDelete.php Standard Delete Example * + * @return array */ function civicrm_api3_activity_delete($params) { @@ -341,7 +327,7 @@ function civicrm_api3_activity_delete($params) { } /** - * Check for required params + * Check for required params. * * @param array $params * Associated array of fields. @@ -385,7 +371,7 @@ SELECT count(*) FROM civicrm_contact WHERE id IN (' . implode(', ', $contactIds) . ' )'; if (count($contactIds) != CRM_Core_DAO::singleValueQuery($sql)) { - throw new API_Exception('Invalid ' . ' Contact Id'); + throw new API_Exception('Invalid Contact Id'); } } @@ -451,6 +437,8 @@ SELECT count(*) } /** + * Get parameters for activity list. + * * @see _civicrm_api3_generic_getlist_params * * @param array $request @@ -472,6 +460,8 @@ function _civicrm_api3_activity_getlist_params(&$request) { } /** + * Get output for activity list. + * * @see _civicrm_api3_generic_getlist_output * * @param array $result diff --git a/api/v3/Batch.php b/api/v3/Batch.php index dee694cd52..1d527b70b7 100644 --- a/api/v3/Batch.php +++ b/api/v3/Batch.php @@ -30,15 +30,10 @@ * * @package CiviCRM_APIv3 * @subpackage API_Batch - * */ /** - * Save a Batch - * - * Allowed @params array keys are: - * {@getfields batch_create} - * @example BatchCreate.php + * Save a Batch. * * @param array $params * diff --git a/api/v3/Case.php b/api/v3/Case.php index 308b98d950..5454994394 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -434,7 +434,7 @@ function _civicrm_api3_case_read($caseId, $options) { } /** - * Internal function to format create params for processing + * Internal function to format create params for processing. * * @param array $params */ @@ -448,7 +448,7 @@ function _civicrm_api3_case_format_params(&$params) { if (!$params['case_type_id']) { $caseTypeLabels = CRM_Case_PseudoConstant::caseType('title', FALSE); $params['case_type_id'] = array_search($params['case_type'], $caseTypeLabels); - $params['case_type'] = $caseTypes[$params['case_type_id']]; // label => name + $params['case_type'] = $caseTypes[$params['case_type_id']]; } } elseif (empty($params['case_type'])) { diff --git a/api/v3/CaseType.php b/api/v3/CaseType.php index 3d00eca7af..29d3af56a3 100644 --- a/api/v3/CaseType.php +++ b/api/v3/CaseType.php @@ -32,7 +32,6 @@ * @package CiviCRM_APIv3 * @subpackage API_Case * @copyright CiviCRM LLC (c) 2004-2014 - * */ /** diff --git a/api/v3/Contact.php b/api/v3/Contact.php index ceb42c52c4..3e33f35e78 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -139,7 +139,9 @@ function _civicrm_api3_contact_create_spec(&$params) { } /** - * Retrieve one or more contacts, given a set of search params + * Retrieve one or more contacts, given a set of search params. + * + * @param array $params * * @return array * API Result Array @@ -152,6 +154,8 @@ function civicrm_api3_contact_get($params) { } /** + * Get count of contact. + * * @param array $params * * @return int diff --git a/api/v3/CustomSearch.php b/api/v3/CustomSearch.php index 3137c49ecf..55197d9c33 100644 --- a/api/v3/CustomSearch.php +++ b/api/v3/CustomSearch.php @@ -1,18 +1,14 @@ fields function & then augment * that information by calling the _spec functions that apply to the relevant function * Note that we use 'unique' field names as described in the xml/schema files diff --git a/api/v3/Job.php b/api/v3/Job.php index 93edc01400..b12d4ae515 100644 --- a/api/v3/Job.php +++ b/api/v3/Job.php @@ -100,13 +100,12 @@ function civicrm_api3_job_delete($params) { * API Result Array */ function civicrm_api3_job_execute($params) { - // @noinspection PhpUnusedParameterInspection $facility = new CRM_Core_JobManager(); $facility->execute(FALSE); - // always creates success - results are handled elsewhere - return civicrm_api3_create_success(); + // Always creates success - results are handled elsewhere. + return civicrm_api3_create_success(1, $params); } /** @@ -400,8 +399,9 @@ function civicrm_api3_job_process_participant($params) { /** - * This api checks and updates the status of all membership records for a given domain using the calc_membership_status and - * update_contact_membership APIs. + * This api checks and updates the status of all membership records for a given domain. + * + * The function uses the calc_membership_status and update_contact_membership APIs. * * IMPORTANT: * Sending renewal reminders has been migrated from this job to the Scheduled Reminders function as of 4.3. @@ -422,7 +422,7 @@ function civicrm_api3_job_process_membership($params) { $lock->release(); if ($result['is_error'] == 0) { - return civicrm_api3_create_success($result['messages']); + return civicrm_api3_create_success($result['messages'], $params); } else { return civicrm_api3_create_error($result['messages']); @@ -457,7 +457,6 @@ function civicrm_api3_job_process_respondent($params) { * * @return array * API Result Array - * */ function civicrm_api3_job_process_batch_merge($params) { $rgid = CRM_Utils_Array::value('rgid', $params); @@ -477,6 +476,8 @@ function civicrm_api3_job_process_batch_merge($params) { } /** + * Metadata for batch merge function. + * * @param $params */ function _civicrm_api3_job_process_batch_merge_spec(&$params) { @@ -501,14 +502,14 @@ function _civicrm_api3_job_process_batch_merge_spec(&$params) { } /** - * Runs handlePaymentCron method in the specified payment processor + * Runs handlePaymentCron method in the specified payment processor. * * @param array $params * Input parameters. * - * Expected @params array keys are: + * Expected @params array keys are: INCORRECTLY DOCUMENTED AND SHOULD BE IN THE _spec function + * for retrieval via getfields. * {string 'processor_name' - the name of the payment processor, eg: Sagepay} - * */ function civicrm_api3_job_run_payment_cron($params) { @@ -536,7 +537,9 @@ function civicrm_api3_job_run_payment_cron($params) { } /** - * This api cleans up all the old session entries and temp tables. We recommend that sites run this on an hourly basis + * This api cleans up all the old session entries and temp tables. + * + * We recommend that sites run this on an hourly basis. * * @param array $params * Sends in various config parameters to decide what needs to be cleaned. @@ -568,26 +571,30 @@ function civicrm_api3_job_cleanup($params) { /** * Set expired relationships to disabled. - * @param $params + * + * @param array $params + * * @return array * @throws \API_Exception */ function civicrm_api3_job_disable_expired_relationships($params) { - /** @noinspection PhpUnusedParameterInspection */ $result = CRM_Contact_BAO_Relationship::disableExpiredRelationships(); if (!$result) { throw new API_Exception('Failed to disable all expired relationships.'); } - return civicrm_api3_create_success(); + return civicrm_api3_create_success(1, $params); } /** - * This api reloads all the smart groups. If the org has a large number of smart groups - * it is recommended that they use the limit clause to limit the number of smart groups - * evaluated on a per job basis. Might also help to increase the smartGroupCacheTimeout - * and use the cache + * This api reloads all the smart groups. + * + * If the org has a large number of smart groups it is recommended that they use the limit clause + * to limit the number of smart groups evaluated on a per job basis. + * + * Might also help to increase the smartGroupCacheTimeout and use the cache. * * @param array $params + * * @return array * @throws \API_Exception */ diff --git a/api/v3/Location.php b/api/v3/Location.php index 40fbdb6263..9f8ee7a661 100644 --- a/api/v3/Location.php +++ b/api/v3/Location.php @@ -1,7 +1,8 @@ fields + * This is a legacy wrapper for api_store_values. + * + * It checks suitable fields using getfields rather than DAO->fields. * - * Getfields has handling for how to deal with uniquenames which dao->fields doesn't + * Getfields has handling for how to deal with unique names which dao->fields doesn't * * Note this is used by BAO type create functions - eg. contribution + * * @param string $entity * @param array $params * @param array $values @@ -403,6 +414,7 @@ function _civicrm_api3_filter_fields_for_bao($entity, &$params, &$values) { _civicrm_api3_store_values($fields, $params, $values); } /** + * Store values. * * @param array $fields * @param array $params @@ -424,7 +436,9 @@ function _civicrm_api3_store_values(&$fields, &$params, &$values) { } /** - * The API supports 2 types of get requestion. The more complex uses the BAO query object. + * Get function for query object api. + * + * The API supports 2 types of get request. The more complex uses the BAO query object. * This is a generic function for those functions that call it * * At the moment only called by contact we should extend to contribution & @@ -433,6 +447,7 @@ function _civicrm_api3_store_values(&$fields, &$params, &$values) { * * Ideally this would be merged with _civicrm_get_query_object but we need to resolve differences in what the * 2 variants call + * * @param $entity * @param array $params * As passed into api get or getcount function. @@ -528,13 +543,15 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti } /** - * get dao query object based on input params + * Get dao query object based on input params. + * * Ideally this would be merged with _civicrm_get_using_query_object but we need to resolve differences in what the * 2 variants call * * @param array $params * @param string $mode * @param string $entity + * * @return array * [CRM_Core_DAO|CRM_Contact_BAO_Query] */ @@ -569,7 +586,8 @@ function _civicrm_api3_get_query_object($params, $mode, $entity) { } /** - * Function transfers the filters being passed into the DAO onto the params object + * Function transfers the filters being passed into the DAO onto the params object. + * * @param CRM_Core_DAO $dao * @param array $params * @param bool $unique @@ -642,7 +660,8 @@ function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $entity) { $dao->selectAdd($returnValue); } - $unmatchedFields = array_diff(// not already matched on the field names + // Not already matched on the field names. + $unmatchedFields = array_diff( array_keys($options['return']), $returnMatched ); @@ -659,7 +678,8 @@ function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $entity) { } /** - * Apply filters (e.g. high, low) to DAO object (prior to find) + * Apply filters (e.g. high, low) to DAO object (prior to find). + * * @param string $filterField * Field name of filter. * @param string $filterValue @@ -908,6 +928,8 @@ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, } /** + * Determine if custom fields need to be retrieved. + * * We currently retrieve all custom fields or none at this level so if we know the entity * && it can take custom fields & there is the string 'custom' in their return request we get them all, they are filtered on the way out * @todo filter so only required fields are queried @@ -923,14 +945,14 @@ function _civicrm_api3_custom_fields_are_required($entity, $params) { return FALSE; } $options = _civicrm_api3_get_options_from_params($params); - //we check for possibility of 'custom' => 1 as well as specific custom fields + // We check for possibility of 'custom' => 1 as well as specific custom fields. $returnString = implode('', $options['return']) . implode('', array_keys($options['return'])); if (stristr($returnString, 'custom')) { return TRUE; } } /** - * Converts an object to an array + * Converts an object to an array. * * @param object $dao * (reference) object to convert.