From 7c31ae578d5ddd411112a2f747255c022d7baa06 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 6 Apr 2019 15:50:26 +1100 Subject: [PATCH] (NFC) Bring up API folder to style of future coder checker --- api/v3/AclRole.php | 1 - api/v3/ActionSchedule.php | 1 - api/v3/Activity.php | 8 +++----- api/v3/Attachment.php | 3 ++- api/v3/Case.php | 11 ++++------- api/v3/CaseType.php | 6 ++++-- api/v3/Contact.php | 13 +++++-------- api/v3/Contribution.php | 2 +- api/v3/CustomField.php | 5 ++--- api/v3/CustomValue.php | 1 - api/v3/Cxn.php | 2 +- api/v3/CxnApp.php | 4 ++-- api/v3/Dashboard.php | 12 +++++------- api/v3/Domain.php | 13 +++---------- api/v3/EntityTag.php | 2 +- api/v3/Event.php | 1 - api/v3/Exception.php | 2 ++ api/v3/Extension.php | 12 ++++++++---- api/v3/Generic.php | 3 ++- api/v3/Generic/Setvalue.php | 3 +-- api/v3/GroupOrganization.php | 1 - api/v3/Job.php | 3 ++- api/v3/LocBlock.php | 2 +- api/v3/Logging.php | 4 ++-- api/v3/Mailing.php | 27 ++++++++++++++------------- api/v3/MailingAB.php | 18 +++++++++--------- api/v3/MailingComponent.php | 1 - api/v3/MailingContact.php | 3 ++- api/v3/MailingRecipients.php | 1 - api/v3/Membership.php | 1 - api/v3/Order.php | 2 +- api/v3/Participant.php | 1 - api/v3/Payment.php | 11 ++++++----- api/v3/PaymentProcessor.php | 1 - api/v3/Pcp.php | 1 + api/v3/Profile.php | 10 +++++----- api/v3/Relationship.php | 2 +- api/v3/ReportTemplate.php | 5 +++-- api/v3/SavedSearch.php | 9 ++++++--- api/v3/Setting.php | 11 ++++++++--- api/v3/Survey.php | 1 - api/v3/System.php | 6 ++++-- api/v3/WordReplacement.php | 1 - api/v3/utils.php | 20 ++++++++++---------- 44 files changed, 121 insertions(+), 126 deletions(-) diff --git a/api/v3/AclRole.php b/api/v3/AclRole.php index 5522845e21..0be3488d1d 100644 --- a/api/v3/AclRole.php +++ b/api/v3/AclRole.php @@ -43,7 +43,6 @@ function civicrm_api3_acl_role_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityRole'); } - /** * AclRole create metadata. * diff --git a/api/v3/ActionSchedule.php b/api/v3/ActionSchedule.php index d7f6e263f6..6ad0164231 100644 --- a/api/v3/ActionSchedule.php +++ b/api/v3/ActionSchedule.php @@ -43,7 +43,6 @@ function civicrm_api3_action_schedule_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActionSchedule'); } - /** * Create a new ActionSchedule. * diff --git a/api/v3/Activity.php b/api/v3/Activity.php index 5fa7492538..ff9ac1258c 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -31,7 +31,6 @@ * @package CiviCRM_APIv3 */ - /** * Creates or updates an Activity. * @@ -291,7 +290,7 @@ function _civicrm_api3_activity_get_spec(&$params) { * @param array $params * Array per getfields documentation. * - * @return array API result array + * @return array * API result array * * @throws \API_Exception @@ -592,7 +591,7 @@ function _civicrm_api3_activity_fill_activity_contact_names(&$activities, $param $typeMap = [ $assigneeType => 'assignee', $sourceType => 'source', - $targetType => 'target' + $targetType => 'target', ]; $activityContactTypes = [$sourceType]; @@ -609,7 +608,7 @@ function _civicrm_api3_activity_fill_activity_contact_names(&$activities, $param 'activity_id', 'record_type_id', 'contact_id.display_name', - 'contact_id' + 'contact_id', ], 'check_permissions' => !empty($params['check_permissions']), ]; @@ -631,7 +630,6 @@ function _civicrm_api3_activity_fill_activity_contact_names(&$activities, $param } } - /** * Delete a specified Activity. * diff --git a/api/v3/Attachment.php b/api/v3/Attachment.php index ea4c42e4da..3d5f39a3b0 100644 --- a/api/v3/Attachment.php +++ b/api/v3/Attachment.php @@ -481,7 +481,8 @@ function _civicrm_api3_attachment_getfields() { // Would be hard to securely handle changes. $spec['entity_table']['title'] = CRM_Utils_Array::value('title', $spec['entity_table'], 'Entity Table') . ' (write-once)'; $spec['entity_id'] = $entityFileFields['entity_id']; - $spec['entity_id']['title'] = CRM_Utils_Array::value('title', $spec['entity_id'], 'Entity ID') . ' (write-once)'; // would be hard to securely handle changes + // would be hard to securely handle changes + $spec['entity_id']['title'] = CRM_Utils_Array::value('title', $spec['entity_id'], 'Entity ID') . ' (write-once)'; $spec['url'] = [ 'title' => 'URL (read-only)', 'description' => 'URL for downloading the file (not searchable, expire-able)', diff --git a/api/v3/Case.php b/api/v3/Case.php index 312c8ba642..8603714c78 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -32,7 +32,6 @@ * @package CiviCRM_APIv3 */ - /** * Open a new case, add client and manager roles, and standard timeline. * @@ -67,11 +66,10 @@ function civicrm_api3_case_create($params) { if (empty($params['id'])) { // Creating a new case, so make sure we have the necessary parameters civicrm_api3_verify_mandatory($params, NULL, [ - 'contact_id', - 'subject', - ['case_type', 'case_type_id'], - ] - ); + 'contact_id', + 'subject', + ['case_type', 'case_type_id'], + ]); } else { // Update an existing case @@ -744,7 +742,6 @@ function _civicrm_api3_case_format_params(&$params) { } } - /** * It actually works a lot better to use the CaseContact api instead of the Case api * for entityRef fields so we can perform the necessary joins, diff --git a/api/v3/CaseType.php b/api/v3/CaseType.php index 155caba2a5..79dd471037 100644 --- a/api/v3/CaseType.php +++ b/api/v3/CaseType.php @@ -52,8 +52,10 @@ function civicrm_api3_case_type_create($params) { } // This is an existing case-type. if (!empty($params['id']) && isset($params['definition']) - && !CRM_Case_BAO_CaseType::isForked($params['id']) // which is not yet forked - && !CRM_Case_BAO_CaseType::isForkable($params['id']) // for which new forks are prohibited + // which is not yet forked + && !CRM_Case_BAO_CaseType::isForked($params['id']) + // for which new forks are prohibited + && !CRM_Case_BAO_CaseType::isForkable($params['id']) ) { unset($params['definition']); } diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 54ce858580..c493cad4c8 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -524,7 +524,6 @@ function civicrm_api3_contact_delete($params) { } } - /** * Check parameters passed in. * @@ -549,12 +548,11 @@ function _civicrm_api3_contact_check_params(&$params) { case 'individual': civicrm_api3_verify_one_mandatory($params, NULL, [ - 'first_name', - 'last_name', - 'email', - 'display_name', - ] - ); + 'first_name', + 'last_name', + 'email', + 'display_name', + ]); break; } @@ -1454,7 +1452,6 @@ WHERE $whereClause return civicrm_api3_create_success($contacts, $params, 'Contact', 'get_by_location', $dao); } - /** * Get parameters for getlist function. * diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 717c6709be..8366a44528 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -672,7 +672,7 @@ function civicrm_api3_contribution_repeattransaction(&$params) { return _ipn_process_transaction($params, $contribution, $input, $ids, $original_contribution); } - catch(Exception $e) { + catch (Exception $e) { throw new API_Exception('failed to load related objects' . $e->getMessage() . "\n" . $e->getTraceAsString()); } } diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index 0ac81d5e94..322f37104c 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -242,9 +242,8 @@ SELECT count(*) break; } - if (in_array($htmlType, [ - 'Select', 'Multi-Select', 'CheckBox', 'Radio']) && - !isset($errors[$fieldName]) + if (in_array($htmlType, ['Select', 'Multi-Select', 'CheckBox', 'Radio']) + && !isset($errors[$fieldName]) ) { $options = CRM_Core_OptionGroup::valuesByID($fieldDetails['option_group_id']); if (!is_array($value)) { diff --git a/api/v3/CustomValue.php b/api/v3/CustomValue.php index 7ada45ac29..48c3f93b85 100644 --- a/api/v3/CustomValue.php +++ b/api/v3/CustomValue.php @@ -31,7 +31,6 @@ * @package CiviCRM_APIv3 */ - /** * Sets custom values for an entity. * diff --git a/api/v3/Cxn.php b/api/v3/Cxn.php index 6f12beb094..66ed809b8b 100644 --- a/api/v3/Cxn.php +++ b/api/v3/Cxn.php @@ -317,7 +317,7 @@ function civicrm_api3_cxn_create($params) { return civicrm_api3_create_success($result, $params, 'Cxn', 'create'); } - catch(Exception $ex){ + catch (Exception $ex) { throw $ex; } } diff --git a/api/v3/CxnApp.php b/api/v3/CxnApp.php index 9e289c8d8a..0045d3b08f 100644 --- a/api/v3/CxnApp.php +++ b/api/v3/CxnApp.php @@ -25,8 +25,8 @@ +--------------------------------------------------------------------+ */ -use \Civi\Cxn\Rpc\Message\AppMetasMessage; -use \Civi\Cxn\Rpc\Message\GarbledMessage; +use Civi\Cxn\Rpc\Message\AppMetasMessage; +use Civi\Cxn\Rpc\Message\GarbledMessage; /** * The CxnApp API provides a pseudo-entity for exploring the list diff --git a/api/v3/Dashboard.php b/api/v3/Dashboard.php index 1cd9bd98f4..b343429cb7 100644 --- a/api/v3/Dashboard.php +++ b/api/v3/Dashboard.php @@ -31,7 +31,6 @@ * @package CiviCRM_APIv3 */ - /** * Creates or updates an Dashlet. * @@ -42,12 +41,11 @@ */ function civicrm_api3_dashboard_create($params) { civicrm_api3_verify_one_mandatory($params, NULL, [ - 'name', - 'label', - 'url', - 'fullscreen_url', - ] - ); + 'name', + 'label', + 'url', + 'fullscreen_url', + ]); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Dashboard'); } diff --git a/api/v3/Domain.php b/api/v3/Domain.php index 552121fbe1..971bf86b3b 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -76,16 +76,9 @@ function civicrm_api3_domain_get($params) { if (!empty($values['location']['phone'])) { $domain['domain_phone'] = [ 'phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', - CRM_Utils_Array::value( - 'phone_type_id', - $values['location']['phone'][1] - ) - ), - 'phone' => CRM_Utils_Array::value( - 'phone', - $values['location']['phone'][1] - ), - ]; + CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), + 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]), + ]; } if (!empty($values['location']['address'])) { diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index 6ed334f781..48ccea152c 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -190,7 +190,7 @@ function civicrm_api3_entity_tag_replace($params) { return civicrm_api3_create_success($result, $params, 'EntityTag', 'replace'); } - catch(Exception $e) { + catch (Exception $e) { $transaction->rollback(); return civicrm_api3_create_error($e->getMessage()); } diff --git a/api/v3/Event.php b/api/v3/Event.php index dba0f7da46..5f58ebc675 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -217,7 +217,6 @@ function _civicrm_api3_event_getisfull(&$event, $event_id) { $event[$event_id]['is_full'] = $event[$event_id]['available_places'] == 0 ? 1 : 0; } - /** * Get event list parameters. * diff --git a/api/v3/Exception.php b/api/v3/Exception.php index 8ed2ada6ac..4275c44a34 100644 --- a/api/v3/Exception.php +++ b/api/v3/Exception.php @@ -24,6 +24,7 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ + /** * Get a Dedupe Exception. * @@ -36,6 +37,7 @@ function civicrm_api3_exception_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } + /** * Create or update an dedupe exception. * diff --git a/api/v3/Extension.php b/api/v3/Extension.php index f079acaee7..a082751801 100644 --- a/api/v3/Extension.php +++ b/api/v3/Extension.php @@ -301,13 +301,15 @@ function civicrm_api3_extension_refresh($params) { if ($params['local']) { $system->getManager()->refresh(); - $system->getManager()->getStatuses(); // force immediate scan + // force immediate scan + $system->getManager()->getStatuses(); } if ($params['remote']) { if ($system->getBrowser()->isEnabled() && empty($system->getBrowser()->checkRequirements)) { $system->getBrowser()->refresh(); - $system->getBrowser()->getExtensions(); // force immediate download + // force immediate download + $system->getBrowser()->getExtensions(); } } @@ -358,7 +360,8 @@ function civicrm_api3_extension_get($params) { continue; } $info = CRM_Extension_System::createExtendedInfo($obj); - $info['id'] = $id++; // backward compatibility with indexing scheme + // backward compatibility with indexing scheme + $info['id'] = $id++; if (!empty($keys)) { if (in_array($key, $keys)) { $result[] = $info; @@ -392,7 +395,8 @@ function civicrm_api3_extension_getremote($params) { $id = 0; foreach ($extensions as $key => $obj) { $info = []; - $info['id'] = $id++; // backward compatibility with indexing scheme + // backward compatibility with indexing scheme + $info['id'] = $id++; $info = array_merge($info, (array) $obj); $result[] = $info; } diff --git a/api/v3/Generic.php b/api/v3/Generic.php index bbc58bfbd1..c88419ccb4 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -130,7 +130,8 @@ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { 'api.required' => 1, 'api.aliases' => [$lowercase_entity . '_id'], 'type' => CRM_Utils_Type::T_INT, - ]]; + ], + ]; break; // Note: adding setvalue case here instead of in a generic spec function because diff --git a/api/v3/Generic/Setvalue.php b/api/v3/Generic/Setvalue.php index b04b1242e3..3c6f4b1017 100644 --- a/api/v3/Generic/Setvalue.php +++ b/api/v3/Generic/Setvalue.php @@ -57,8 +57,7 @@ function civicrm_api3_generic_setValue($apiRequest) { $fields = civicrm_api($entity, 'getFields', [ 'version' => 3, 'action' => 'create', - "sequential"] - ); + ]); // getfields error, shouldn't happen. if ($fields['is_error']) { return $fields; diff --git a/api/v3/GroupOrganization.php b/api/v3/GroupOrganization.php index 858df4bd97..481e344337 100644 --- a/api/v3/GroupOrganization.php +++ b/api/v3/GroupOrganization.php @@ -31,7 +31,6 @@ * @package CiviCRM_APIv3 */ - /** * Get group organization record/s. * diff --git a/api/v3/Job.php b/api/v3/Job.php index 0c28926fe3..86cfa253d2 100644 --- a/api/v3/Job.php +++ b/api/v3/Job.php @@ -228,6 +228,7 @@ function civicrm_api3_job_send_reminder($params) { return civicrm_api3_create_error($result['messages']); } } + /** * Adjust metadata for "send_reminder" action. * @@ -244,6 +245,7 @@ function _civicrm_api3_job_send_reminder(&$params) { 'title' => 'Action Schedule ID', ]; } + /** * Execute a specific report instance and send the output via email. * @@ -464,7 +466,6 @@ function civicrm_api3_job_process_participant($params) { } } - /** * This api checks and updates the status of all membership records for a given domain. * diff --git a/api/v3/LocBlock.php b/api/v3/LocBlock.php index 5f9b1ce9e4..0e7ef7c642 100644 --- a/api/v3/LocBlock.php +++ b/api/v3/LocBlock.php @@ -86,7 +86,7 @@ function civicrm_api3_loc_block_create($params) { _civicrm_api3_object_to_array($dao, $values[$dao->id]); return civicrm_api3_create_success($values, $params, 'LocBlock', 'create', $dao); } - throw New API_Exception('Unable to create LocBlock. Please check your params.'); + throw new API_Exception('Unable to create LocBlock. Please check your params.'); } /** diff --git a/api/v3/Logging.php b/api/v3/Logging.php index 22ebe9bd39..7b1353ad82 100644 --- a/api/v3/Logging.php +++ b/api/v3/Logging.php @@ -37,7 +37,7 @@ * @param array $params * * @return array - * API Success Array + * API Success Array * @throws \API_Exception * @throws \Civi\API\Exception\UnauthorizedException */ @@ -88,7 +88,7 @@ function _civicrm_api3_logging_revert_spec(&$params) { * @param array $params * * @return array - * API Success Array + * API Success Array * @throws \API_Exception * @throws \Civi\API\Exception\UnauthorizedException */ diff --git a/api/v3/Mailing.php b/api/v3/Mailing.php index 38ebc4161e..86139b2d2f 100644 --- a/api/v3/Mailing.php +++ b/api/v3/Mailing.php @@ -38,7 +38,7 @@ * @param array $params * * @return array - * API Success Array + * API Success Array * @throws \API_Exception * @throws \Civi\API\Exception\UnauthorizedException */ @@ -440,7 +440,8 @@ function _civicrm_api3_mailing_event_reply_spec(&$params) { $params['hash']['api.required'] = 1; $params['hash']['title'] = 'Hash'; $params['replyTo']['api.required'] = 0; - $params['replyTo']['title'] = 'Reply To';//doesn't really explain adequately + //doesn't really explain adequately + $params['replyTo']['title'] = 'Reply To'; } /** @@ -635,17 +636,17 @@ function civicrm_api3_mailing_send_test($params) { $testEmailParams['emails'] = array_key_exists('test_email', $testEmailParams) ? explode(',', strtolower($testEmailParams['test_email'])) : NULL; if (!empty($params['test_email'])) { $query = CRM_Utils_SQL_Select::from('civicrm_email e') - ->select(['e.id', 'e.contact_id', 'e.email']) - ->join('c', 'INNER JOIN civicrm_contact c ON e.contact_id = c.id') - ->where('e.email IN (@emails)', ['@emails' => $testEmailParams['emails']]) - ->where('e.on_hold = 0') - ->where('c.is_opt_out = 0') - ->where('c.do_not_email = 0') - ->where('c.is_deceased = 0') - ->where('c.is_deleted = 0') - ->groupBy('e.id') - ->orderBy(['e.is_bulkmail DESC', 'e.is_primary DESC']) - ->toSQL(); + ->select(['e.id', 'e.contact_id', 'e.email']) + ->join('c', 'INNER JOIN civicrm_contact c ON e.contact_id = c.id') + ->where('e.email IN (@emails)', ['@emails' => $testEmailParams['emails']]) + ->where('e.on_hold = 0') + ->where('c.is_opt_out = 0') + ->where('c.do_not_email = 0') + ->where('c.is_deceased = 0') + ->where('c.is_deleted = 0') + ->groupBy('e.id') + ->orderBy(['e.is_bulkmail DESC', 'e.is_primary DESC']) + ->toSQL(); $dao = CRM_Core_DAO::executeQuery($query); $emailDetail = []; // fetch contact_id and email id for all existing emails diff --git a/api/v3/MailingAB.php b/api/v3/MailingAB.php index 2ef7637d37..077b8bf2d4 100644 --- a/api/v3/MailingAB.php +++ b/api/v3/MailingAB.php @@ -135,13 +135,13 @@ function civicrm_api3_mailing_a_b_submit($params) { throw new API_Exception("Cannot transition to state 'Testing'"); } civicrm_api3('Mailing', 'submit', $submitParams + [ - 'id' => $dao->mailing_id_a, - '_skip_evil_bao_auto_recipients_' => 0, - ]); + 'id' => $dao->mailing_id_a, + '_skip_evil_bao_auto_recipients_' => 0, + ]); civicrm_api3('Mailing', 'submit', $submitParams + [ - 'id' => $dao->mailing_id_b, - '_skip_evil_bao_auto_recipients_' => 1, - ]); + 'id' => $dao->mailing_id_b, + '_skip_evil_bao_auto_recipients_' => 1, + ]); CRM_Mailing_BAO_MailingAB::distributeRecipients($dao); break; @@ -150,9 +150,9 @@ function civicrm_api3_mailing_a_b_submit($params) { throw new API_Exception("Cannot transition to state 'Final'"); } civicrm_api3('Mailing', 'submit', $submitParams + [ - 'id' => $dao->mailing_id_c, - '_skip_evil_bao_auto_recipients_' => 1, - ]); + 'id' => $dao->mailing_id_c, + '_skip_evil_bao_auto_recipients_' => 1, + ]); break; default: diff --git a/api/v3/MailingComponent.php b/api/v3/MailingComponent.php index 47d59c8d53..886dc2321c 100644 --- a/api/v3/MailingComponent.php +++ b/api/v3/MailingComponent.php @@ -44,7 +44,6 @@ function civicrm_api3_mailing_component_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingComponent'); } - /** * Adjust Metadata for Create action. * diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index b4eedb52b1..e4d693a258 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -83,7 +83,8 @@ function _civicrm_api3_mailing_contact_get_spec(&$params) { $params['type'] = [ 'api.default' => 'Delivered', - 'title' => 'Type', // doesn't really explain the field - but not sure I understand it to explain it better + // doesn't really explain the field - but not sure I understand it to explain it better + 'title' => 'Type', 'type' => CRM_Utils_Type::T_STRING, 'options' => [ 'Delivered' => 'Delivered', diff --git a/api/v3/MailingRecipients.php b/api/v3/MailingRecipients.php index 27be1c7cf1..ce2a8547e0 100644 --- a/api/v3/MailingRecipients.php +++ b/api/v3/MailingRecipients.php @@ -31,7 +31,6 @@ * @package CiviCRM_APIv3 */ - /** * Returns array of MailingRecipients. * diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 7d9b86ac49..af6ba7a0fc 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -280,7 +280,6 @@ function _civicrm_api3_membership_get_customv2behaviour(&$params, $membershipTyp return $membershipValues; } - /** * Non-standard behaviour inherited from v2. * diff --git a/api/v3/Order.php b/api/v3/Order.php index fff662a96a..e895e0fc11 100644 --- a/api/v3/Order.php +++ b/api/v3/Order.php @@ -189,7 +189,7 @@ function civicrm_api3_order_cancel($params) { */ function _civicrm_api3_order_cancel_spec(&$params) { $params['contribution_id'] = [ - 'api.required' => 1 , + 'api.required' => 1, 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, ]; diff --git a/api/v3/Participant.php b/api/v3/Participant.php index d9b75b3be0..3685254825 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -128,7 +128,6 @@ function _civicrm_api3_participant_createlineitem(&$params, $participant) { } } - /** * Adjust Metadata for Create action. * diff --git a/api/v3/Payment.php b/api/v3/Payment.php index 25e4ae17e9..69367bf6f0 100644 --- a/api/v3/Payment.php +++ b/api/v3/Payment.php @@ -150,12 +150,12 @@ function civicrm_api3_payment_create(&$params) { function _civicrm_api3_payment_create_spec(&$params) { $params = [ 'contribution_id' => [ - 'api.required' => 1 , + 'api.required' => 1, 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, ], 'total_amount' => [ - 'api.required' => 1 , + 'api.required' => 1, 'title' => 'Total Payment Amount', 'type' => CRM_Utils_Type::T_FLOAT, ], @@ -209,7 +209,7 @@ function _civicrm_api3_payment_get_spec(&$params) { function _civicrm_api3_payment_delete_spec(&$params) { $params = [ 'id' => [ - 'api.required' => 1 , + 'api.required' => 1, 'title' => 'Payment ID', 'type' => CRM_Utils_Type::T_INT, 'api.aliases' => ['payment_id'], @@ -228,7 +228,7 @@ function _civicrm_api3_payment_delete_spec(&$params) { function _civicrm_api3_payment_cancel_spec(&$params) { $params = [ 'id' => [ - 'api.required' => 1 , + 'api.required' => 1, 'title' => 'Payment ID', 'type' => CRM_Utils_Type::T_INT, 'api.aliases' => ['payment_id'], @@ -263,7 +263,8 @@ function civicrm_api3_payment_sendconfirmation($params) { 'subject' => $result[1], 'message_txt' => $result[2], 'message_html' => $result[3], - ]]); + ], + ]); } /** diff --git a/api/v3/PaymentProcessor.php b/api/v3/PaymentProcessor.php index 658b51aae3..51e401c75e 100644 --- a/api/v3/PaymentProcessor.php +++ b/api/v3/PaymentProcessor.php @@ -93,7 +93,6 @@ function civicrm_api3_payment_processor_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } - /** * Set default getlist parameters. * diff --git a/api/v3/Pcp.php b/api/v3/Pcp.php index 3380fe242c..71c61e7711 100644 --- a/api/v3/Pcp.php +++ b/api/v3/Pcp.php @@ -32,6 +32,7 @@ * * @package CiviCRM_APIv3 */ + /** * Create or update a survey. * diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 6c25483f36..1d6cfe80b9 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -446,7 +446,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) { 'api.email.get.1' => ['location_type_id' => 'Billing'], 'api.email.get.2' => ['is_billing' => TRUE], 'return' => 'api.email.get, api.address.get, api.address.getoptions, country, state_province, email, first_name, last_name, middle_name, ' . implode($addressFields, ','), - ] + ] ); $values = [ @@ -611,10 +611,10 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = } /** * putting this on hold -this would cause the api to set the default - but could have unexpected behaviour - if (isset($result['values'][$realName]['default_value'])) { - //this would be the case for a custom field with a configured default - $profileFields[$profileID][$entityfield]['api.default'] = $result['values'][$realName]['default_value']; - } + * if (isset($result['values'][$realName]['default_value'])) { + * //this would be the case for a custom field with a configured default + * $profileFields[$profileID][$entityfield]['api.default'] = $result['values'][$realName]['default_value']; + * } */ } } diff --git a/api/v3/Relationship.php b/api/v3/Relationship.php index 0a7254cc9a..d08889cd89 100644 --- a/api/v3/Relationship.php +++ b/api/v3/Relationship.php @@ -216,6 +216,6 @@ function _civicrm_api3_relationship_getoptions_spec(&$params) { 'title' => ts('Is Form?'), 'description' => $relationshipTypePrefix . ts('Formats the options for use' . ' in a form if true. The format is <id>_a_b => <label>'), - 'type' => CRM_Utils_Type::T_BOOLEAN + 'type' => CRM_Utils_Type::T_BOOLEAN, ]; } diff --git a/api/v3/ReportTemplate.php b/api/v3/ReportTemplate.php index 87d54afdce..5fd7474318 100644 --- a/api/v3/ReportTemplate.php +++ b/api/v3/ReportTemplate.php @@ -135,7 +135,7 @@ function _civicrm_api3_report_template_getrows($params) { 'option_group_name' => 'report_template', 'return' => 'name', 'value' => $params['report_id'], - ] + ] ); $reportInstance = new $class(); @@ -154,7 +154,7 @@ function _civicrm_api3_report_template_getrows($params) { $reportInstance->beginPostProcessCommon(); $sql = $reportInstance->buildQuery(); $reportInstance->addToDeveloperTab($sql); - $rows = $metadata = $requiredMetadata = []; + $rows = $metadata = $requiredMetadata = []; $reportInstance->buildRows($sql, $rows); $reportInstance->formatDisplay($rows); @@ -191,6 +191,7 @@ function civicrm_api3_report_template_getstatistics($params) { $reportInstance->cleanUpTemporaryTables(); return civicrm_api3_create_success($stats, $params, 'ReportTemplate', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata); } + /** * Adjust metadata for template getrows action. * diff --git a/api/v3/SavedSearch.php b/api/v3/SavedSearch.php index 4c6b7a2fd4..c515e890e2 100644 --- a/api/v3/SavedSearch.php +++ b/api/v3/SavedSearch.php @@ -38,7 +38,8 @@ * @param array $params * Associative array of property name-value pairs to insert in new saved search. * @example SavedSearch/Create.php Std create example. - * @return array api result array + * @return array + * api result array * {@getfields saved_search_create} * @access public */ @@ -72,7 +73,8 @@ function civicrm_api3_saved_search_create($params) { * Associative array of property name-value pairs. $params['id'] should be * the ID of the saved search to be deleted. * @example SavedSearch/Delete.php Std delete example. - * @return array api result array + * @return array + * api result array * {@getfields saved_search_delete} * @access public */ @@ -86,7 +88,8 @@ function civicrm_api3_saved_search_delete($params) { * @param array $params * An associative array of name-value pairs. * @example SavedSearch/Get.php Std get example. - * @return array api result array + * @return array + * api result array * {@getfields saved_search_get} * @access public */ diff --git a/api/v3/Setting.php b/api/v3/Setting.php index 21a38ed52d..e7d2338c25 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -44,12 +44,14 @@ function civicrm_api3_setting_getfields($params) { 'name' => [ 'title' => 'name of setting field', 'api.required' => 1, - 'type' => CRM_Utils_Type::T_STRING], + 'type' => CRM_Utils_Type::T_STRING, + ], 'group' => [ 'api.required' => 0, 'title' => 'Setting Group', 'description' => 'Settings Group. This is required if the setting is not stored in config', - 'type' => CRM_Utils_Type::T_STRING], + 'type' => CRM_Utils_Type::T_STRING, + ], ]; return civicrm_api3_create_success($result, $params, 'Setting', 'getfields'); } @@ -121,6 +123,7 @@ function civicrm_api3_setting_getdefaults(&$params) { } return civicrm_api3_create_success($defaults, $params, 'Setting', 'getfields'); } + /** * Metadata for Setting create function. * @@ -320,6 +323,7 @@ function civicrm_api3_setting_get($params) { $result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, [])); return civicrm_api3_create_success($result, $params, 'Setting', 'get'); } + /** * Metadata for setting create function. * @@ -337,6 +341,7 @@ function _civicrm_api3_setting_get_spec(&$params) { 'description' => 'if you know the group defining it will make the api more efficient', ]; } + /** * Returns value for specific parameter. * @@ -417,7 +422,7 @@ function _civicrm_api3_setting_getDomainArray(&$params) { } if ($params['domain_id'] == 'current_domain') { - $params['domain_id'] = CRM_Core_Config::domainID(); + $params['domain_id'] = CRM_Core_Config::domainID(); } if ($params['domain_id'] == 'all') { diff --git a/api/v3/Survey.php b/api/v3/Survey.php index dbea9f1ec3..3b4605a27d 100644 --- a/api/v3/Survey.php +++ b/api/v3/Survey.php @@ -35,7 +35,6 @@ * @package CiviCRM_APIv3 */ - /** * Create or update a survey. * diff --git a/api/v3/System.php b/api/v3/System.php index baf4fe197b..b15a471bbd 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -230,8 +230,10 @@ function civicrm_api3_system_get($params) { $config = CRM_Core_Config::singleton(); $returnValues = [ [ - 'version' => CRM_Utils_System::version(), // deprecated in favor of civi.version - 'uf' => CIVICRM_UF, // deprecated in favor of cms.type + // deprecated in favor of civi.version + 'version' => CRM_Utils_System::version(), + // deprecated in favor of cms.type + 'uf' => CIVICRM_UF, 'php' => [ 'version' => phpversion(), 'time' => time(), diff --git a/api/v3/WordReplacement.php b/api/v3/WordReplacement.php index 25bdbfd321..b5bc93a19b 100644 --- a/api/v3/WordReplacement.php +++ b/api/v3/WordReplacement.php @@ -46,7 +46,6 @@ function civicrm_api3_word_replacement_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } - /** * Create a new Word Replacement. * diff --git a/api/v3/utils.php b/api/v3/utils.php index de3253668a..bac0826f5c 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -213,7 +213,7 @@ function civicrm_api3_create_success($values = 1, $params = [], $entity = NULL, 'option_sort', 'options', 'prettyprint', - ]); + ]); if ($undefined) { $result['undefined_fields'] = array_merge($undefined); } @@ -432,6 +432,7 @@ function _civicrm_api3_filter_fields_for_bao($entity, &$params, &$values) { $fields = $fields['values']; _civicrm_api3_store_values($fields, $params, $values); } + /** * Store values. * @@ -1767,9 +1768,9 @@ function _civicrm_api3_validate_unique_key(&$params, &$fieldName) { return; } $existing = civicrm_api($params['entity'], 'get', [ - 'version' => $params['version'], - $fieldName => $fieldValue, - ]); + 'version' => $params['version'], + $fieldName => $fieldValue, + ]); // an entry already exists for this unique field if ($existing['count'] == 1) { // question - could this ever be a security issue? @@ -1836,9 +1837,9 @@ function _civicrm_api3_generic_replace($entity, $params) { ); foreach ($staleIDs as $staleID) { $delete = civicrm_api($entity, 'delete', [ - 'version' => $params['version'], - 'id' => $staleID, - ]); + 'version' => $params['version'], + 'id' => $staleID, + ]); if (civicrm_error($delete)) { $transaction->rollback(); return $delete; @@ -1847,11 +1848,11 @@ function _civicrm_api3_generic_replace($entity, $params) { return civicrm_api3_create_success($creates, $params); } - catch(PEAR_Exception $e) { + catch (PEAR_Exception $e) { $transaction->rollback(); return civicrm_api3_create_error($e->getMessage()); } - catch(Exception $e) { + catch (Exception $e) { $transaction->rollback(); return civicrm_api3_create_error($e->getMessage()); } @@ -1984,7 +1985,6 @@ function _civicrm_api_get_custom_fields($entity, &$params) { return $ret; } - /** * Fill params array with alternate (alias) values where a field has an alias and that is filled & the main field isn't. * -- 2.25.1