code cleanup (break apart long lines)
authorAndrew Engelbrecht <andrew@fsf.org>
Thu, 21 Apr 2022 14:34:25 +0000 (10:34 -0400)
committerroot <root@login0d.fsf.org>
Thu, 21 Apr 2022 14:34:25 +0000 (10:34 -0400)
lib/Auth/Source/FSFDrupalAuth.php

index 8311a06356f938159ba6b021a612420b9d950664..6eafa537bc987982f732768055a49dd5829f62eb 100644 (file)
@@ -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'])) {