From: Eileen McNaughton Date: Wed, 11 Feb 2015 21:28:40 +0000 (+1300) Subject: reduce unnecessary variable passing (config & session objects) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=13befc9e5874af8af1a924f36cf6fc14021158f5;p=civicrm-core.git reduce unnecessary variable passing (config & session objects) I've also marked the fn as protected as my grepping showed it wasn't called from elsewhere --- diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index cdba02c119..72fbdc23b5 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1179,12 +1179,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->_contactID = $submittedValues['contact_id']; } - $config = CRM_Core_Config::singleton(); - - //Credit Card Contribution. + // Credit Card Contribution. if ($this->_mode) { - $session = CRM_Core_Session::singleton(); - $this->processCreditCard($submittedValues, $config, $session, $lineItem); + $this->processCreditCard($submittedValues, $lineItem); } else { //Offline Contribution. @@ -1510,13 +1507,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP * Process credit card payment. * * @param array $submittedValues - * @param CRM_Core_Config $config - * @param CRM_Core_Session $session * @param array $lineItem * * @throws CRM_Core_Exception */ - public function processCreditCard($submittedValues, $config, $session, $lineItem) { + protected function processCreditCard($submittedValues, $lineItem) { $sendReceipt = $contribution = FALSE; $unsetParams = array( @@ -1738,7 +1733,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // Set source if not set if (empty($this->_params['source'])) { - $userID = $session->get('userID'); + $userID = CRM_Core_Session::singleton()->get('userID'); $userSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $userID, 'sort_name' );