Further phpcs & comment clean up
authorEileen McNaughton <eileen@fuzion.co.nz>
Wed, 11 Feb 2015 21:22:12 +0000 (10:22 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 11 Feb 2015 21:22:12 +0000 (10:22 +1300)
CRM/Contribute/Form/Contribution.php

index 08b626636540d9a8ff2511f7007c824544780481..cdba02c1194a32f51690e3190937d9ad5a8bad16 100644 (file)
@@ -167,8 +167,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
   public $_honoreeProfileType;
 
   /**
-   * Array of billing panes to be displayed by billingBlock.tpl - currently this is likely to look like
-   * array('Credit Card' => ts('Credit Card') or array('Direct Debit => ts('Direct Debit')
+   * Array of billing panes to be displayed by billingBlock.tpl.
+   * Currently this is likely to look like
+   * array('Credit Card' => ts('Credit Card') or
+   * array('Direct Debit => ts('Direct Debit')
    * @todo billing details (address stuff) to be added when we stop hard coding the panes in billingBlock.tpl
    *
    * @var array
@@ -183,7 +185,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    */
   public $_paymentFields = array();
   /**
-   * Logged in user's email
+   * Logged in user's email.
    * @var string
    */
   public $userEmail;
@@ -220,12 +222,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    */
   public function preProcess() {
 
-    //check permission for action.
+    // Check permission for action.
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
       CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
 
-    //@todo - if anyone ever figures out what this cdtype subroutine is about (or even if it still applies) please add comments
+    //@todo - if anyone ever figures out what this _cdType subroutine is about (or even if it still applies) please
+    // add comments
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     if ($this->_cdType) {
@@ -236,22 +239,22 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
 
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
 
-    // get price set id.
+    // Get price set id.
     $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
     $this->set('priceSetId', $this->_priceSetId);
     $this->assign('priceSetId', $this->_priceSetId);
 
-    //get the pledge payment id
+    // Get the pledge payment id
     $this->_ppID = CRM_Utils_Request::retrieve('ppid', 'Positive', $this);
 
-    //get the contact id
+    // Get the contact id
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
 
-    //get the action.
+    // Get the action.
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->assign('action', $this->_action);
 
-    //get the contribution id if update
+    // Get the contribution id if update
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if (!empty($this->_id)) {
       $this->assign('contribID', $this->_id);
@@ -324,6 +327,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     }
   }
 
+  /**
+   * Set default values.
+   *
+   * @return array
+   */
   public function setDefaultValues() {
     if ($this->_cdType) {
       return CRM_Custom_Form_CustomData::setDefaultValues($this);
@@ -439,7 +447,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       'receipt_date',
       'cancel_date',
       'thankyou_date',
-      );
+    );
     foreach ($dates as $key) {
       if (!empty($defaults[$key])) {
         list($defaults[$key], $defaults[$key . '_time'])
@@ -1502,7 +1510,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    * Process credit card payment.
    *
    * @param array $submittedValues
-   * @param array $config
+   * @param CRM_Core_Config $config
    * @param CRM_Core_Session $session
    * @param array $lineItem
    *
@@ -1536,7 +1544,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->_mode
     );
 
-    //get the payment processor id as per mode.
+    // Get the payment processor id as per mode.
     $this->_params['payment_processor'] = $params['payment_processor_id']
       = $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
 
@@ -1551,7 +1559,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->assign('displayName', $this->userDisplayName);
     }
 
-    //set email for primary location.
+    // Set email for primary location.
     $fields['email-Primary'] = 1;
     $params['email-Primary'] = $this->userEmail;
 
@@ -1609,7 +1617,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $this->_params['description'] = ts('Office Credit Card contribution');
     $this->_params['currencyID'] = CRM_Utils_Array::value('currency',
       $this->_params,
-      $config->defaultCurrency
+      CRM_Core_Config::singleton()->defaultCurrency
     );
     $this->_params['payment_action'] = 'Sale';
     if (!empty($this->_params['receive_date'])) {
@@ -1635,7 +1643,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->_params['invoiceID'] = $this->_params['invoice_id'];
     }
 
-    // at this point we've created a contact and stored its address etc
+    // At this point we've created a contact and stored its address etc
     // all the payment processors expect the name and address to be in the
     // so we copy stuff over to first_name etc.
     $paymentParams = $this->_params;
@@ -1645,8 +1653,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $contributionType = new CRM_Financial_DAO_FinancialType();
     $contributionType->id = $params['financial_type_id'];
 
-    // add some financial type details to the params list
-    // if folks need to use it
+    // Add some financial type details to the params list
+    // if folks need to use it.
     $paymentParams['contributionType_name'] = $this->_params['contributionType_name'] = $contributionType->name;
     $paymentParams['contributionPageID'] = NULL;
 
@@ -1692,7 +1700,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       catch (CRM_Core_Exception $e) {
         $message = ts("Payment Processor Error message") . $e->getMessage();
         $this->cleanupDBAfterPaymentFailure($paymentParams, $message);
-        //set the contribution mode.
+        // Set the contribution mode.
         $urlParams = "action=add&cid={$this->_contactID}";
         if ($this->_mode) {
           $urlParams .= "&mode={$this->_mode}";
@@ -1721,14 +1729,14 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $this->assign('trxn_id', $result['trxn_id']);
     $this->assign('receive_date', $this->_params['receive_date']);
 
-    // result has all the stuff we need
+    // Result has all the stuff we need
     // lets archive it to a financial transaction
     if ($contributionType->is_deductible) {
       $this->assign('is_deductible', TRUE);
       $this->set('is_deductible', TRUE);
     }
 
-    // set source if not set
+    // Set source if not set
     if (empty($this->_params['source'])) {
       $userID = $session->get('userID');
       $userSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $userID,
@@ -1737,7 +1745,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->_params['source'] = ts('Submit Credit Card Payment by: %1', array(1 => $userSortName));
     }
 
-    // build custom data getFields array
+    // Build custom data getFields array
     $customFieldsContributionType = CRM_Core_BAO_CustomField::getFields('Contribution', FALSE, FALSE,
       CRM_Utils_Array::value('financial_type_id', $params)
     );
@@ -1761,7 +1769,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       );
     }
 
-    //send receipt mail.
+    // Send receipt mail.
     if ($contribution->id && !empty($this->_params['is_email_receipt'])) {
       $this->_params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result);
       $this->_params['contact_id'] = $this->_contactID;
@@ -1780,7 +1788,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
 
     //update pledge payment status.
     if ($this->_ppID && $contribution->id) {
-      //store contribution id in payment record.
+      // Store contribution id in payment record.
       CRM_Core_DAO::setFieldValue('CRM_Pledge_DAO_PledgePayment', $this->_ppID, 'contribution_id', $contribution->id);
 
       CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($this->_pledgeID,