From ccf1684dc30019e5a026b4bef771230e6fe3fab2 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Thu, 21 Apr 2022 10:34:25 -0400 Subject: [PATCH] code cleanup (break apart long lines) --- lib/Auth/Source/FSFDrupalAuth.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/Auth/Source/FSFDrupalAuth.php b/lib/Auth/Source/FSFDrupalAuth.php index 8311a06..6eafa53 100644 --- a/lib/Auth/Source/FSFDrupalAuth.php +++ b/lib/Auth/Source/FSFDrupalAuth.php @@ -298,7 +298,7 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase * @param boolean $all_contribs Pass as 'all_contribs' param. The var may also be null to exclude it * @param boolean $gift_redeem_page_id Pass as 'gift_redeem_page_id' param. The var may also be null to exclude it */ - $meets_a_donation_criterion = function ($query_name, $amount, $extra_params) + $meets_a_donation_criterion = function ($query_name, $extra_params, $amount) use ($username, $start_date, $end_date, $attributes) { $parameters = ['username' => $username]; @@ -317,17 +317,15 @@ class FSFDrupalAuth extends \SimpleSAML\Module\core\Auth\UserPassBase return false; }; - if (($meets_a_donation_criterion('query_nomination_process_donations', - intval($this->donation_threshold), ['all_contribs' => true, 'start_date' => $start_date, 'end_date' => $end_date]) + $donation_params = ['start_date' => $start_date, 'end_date' => $end_date, 'all_contribs' => true]; + $membership_params = ['start_date' => $start_date, 'end_date' => $end_date, 'all_contribs' => false]; + $gift_member_params = ['start_date' => $start_date, 'end_date' => $end_date, 'gift_redeem_page_id' => intval($this->gift_redeem_page_id)]; + $adhoc_params = ['adhoc_access_group_id' => intval($this->adhoc_access_group_id)]; - || $meets_a_donation_criterion('query_nomination_process_donations', - intval($this->membership_donation_threshold), ['all_contribs' => false, 'start_date' => $start_date, 'end_date' => $end_date]) - - || $meets_a_donation_criterion('query_nomination_process_gift_receipt', - 1, ['gift_redeem_page_id' => intval($this->gift_redeem_page_id), 'start_date' => $start_date, 'end_date' => $end_date]) - - || $meets_a_donation_criterion('query_nomination_process_adhoc', - 1, ['adhoc_access_group_id' => intval($this->adhoc_access_group_id)]) + if (($meets_a_donation_criterion('query_nomination_process_donations', $donation_params, intval($this->donation_threshold)) + || $meets_a_donation_criterion('query_nomination_process_donations', $membership_params, intval($this->membership_donation_threshold)) + || $meets_a_donation_criterion('query_nomination_process_gift_receipt', $gift_member_params, 1) + || $meets_a_donation_criterion('query_nomination_process_adhoc', $adhoc_params, 1) ) && ($attributes['is_member'] == ['true'])) { -- 2.25.1