From 8ff71e277e0154279af5fdd1ddec05ba98d4200c Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Wed, 10 Oct 2018 10:22:28 +0200 Subject: [PATCH] Fix code style issues. --- CRM/Twingle/Form/Profile.php | 13 +++++++++++++ CRM/Twingle/Form/Settings.php | 2 ++ CRM/Twingle/Submission.php | 14 ++++++++------ api/v3/TwingleDonation/Cancel.php | 1 - api/v3/TwingleDonation/EndRecurring.php | 1 - 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CRM/Twingle/Form/Profile.php b/CRM/Twingle/Form/Profile.php index 718a0e9..785ccc2 100644 --- a/CRM/Twingle/Form/Profile.php +++ b/CRM/Twingle/Form/Profile.php @@ -280,6 +280,10 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { /** * Retrieves location types present within the system as options for select * form elements. + * + * @return array + * + * @throws \CiviCRM_API3_Exception */ public function getLocationTypes() { $location_types = array(); @@ -296,6 +300,10 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { /** * Retrieves financial types present within the system as options for select * form elements. + * + * @return array + * + * @throws \CiviCRM_API3_Exception */ public function getFinancialTypes() { $financial_types = array(); @@ -313,6 +321,10 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { /** * Retrieves campaigns present within the system as options for select form * elements. + * + * @return array + * + * @throws \CiviCRM_API3_Exception */ public function getGenderOptions() { $genders = array(); @@ -335,6 +347,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { * Retrieves CiviSEPA creditors as options for select form elements. * * @return array + * * @throws \CiviCRM_API3_Exception */ public function getSepaCreditors() { diff --git a/CRM/Twingle/Form/Settings.php b/CRM/Twingle/Form/Settings.php index f2ee874..a8460a2 100644 --- a/CRM/Twingle/Form/Settings.php +++ b/CRM/Twingle/Form/Settings.php @@ -132,6 +132,8 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form { * Get the settings we are going to allow to be set on this form. * * @return array + * + * @throws \CiviCRM_API3_Exception */ function getFormSettings() { if (empty($this->_settings)) { diff --git a/CRM/Twingle/Submission.php b/CRM/Twingle/Submission.php index 5356139..b742533 100644 --- a/CRM/Twingle/Submission.php +++ b/CRM/Twingle/Submission.php @@ -90,13 +90,15 @@ class CRM_Twingle_Submission { // Get the gender ID defined within the profile, or return an error if none // matches (i.e. an unknown gender was submitted). - if (!empty($params['user_gender']) && !$gender_id = $profile->getAttribute('gender_' . $params['user_gender'])) { - throw new CiviCRM_API3_Exception( - E::ts('Gender could not be matched to existing gender.'), - 'invalid_format' - ); + if (!empty($params['user_gender'])) { + if (!$gender_id = $profile->getAttribute('gender_' . $params['user_gender'])) { + throw new CiviCRM_API3_Exception( + E::ts('Gender could not be matched to existing gender.'), + 'invalid_format' + ); + } + $params['gender_id'] = $gender_id; } - $params['gender_id'] = $gender_id; } /** diff --git a/api/v3/TwingleDonation/Cancel.php b/api/v3/TwingleDonation/Cancel.php index ec43f2e..d82a26e 100644 --- a/api/v3/TwingleDonation/Cancel.php +++ b/api/v3/TwingleDonation/Cancel.php @@ -63,7 +63,6 @@ function _civicrm_api3_twingle_donation_Cancel_spec(&$params) { * @return array API result descriptor * @see civicrm_api3_create_success * @see civicrm_api3_create_error - * @throws API_Exception */ function civicrm_api3_twingle_donation_Cancel($params) { try { diff --git a/api/v3/TwingleDonation/EndRecurring.php b/api/v3/TwingleDonation/EndRecurring.php index 6d592da..356c39b 100644 --- a/api/v3/TwingleDonation/EndRecurring.php +++ b/api/v3/TwingleDonation/EndRecurring.php @@ -56,7 +56,6 @@ function _civicrm_api3_twingle_donation_EndRecurring_spec(&$params) { * @return array API result descriptor * @see civicrm_api3_create_success * @see civicrm_api3_create_error - * @throws API_Exception */ function civicrm_api3_twingle_donation_EndRecurring($params) { try {