Merge pull request #4958 from pratikshad/code-cleanup-batch-19
[civicrm-core.git] / CRM / Core / Payment / PaymentExpress.php
index ffe15b8abb301d9a91c7016f5acc479e7a027a68..7b181db47f369d0324cd3cee623c095fb717763d 100644 (file)
@@ -46,7 +46,6 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
    * pattern and cache the instance in this variable
    *
    * @var object
-   * @static
    */
   static private $_singleton = NULL;
 
@@ -67,39 +66,13 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
     $this->_processorName = ts('DPS Payment Express');
   }
 
-  /**
-   * Singleton function used to manage this object
-   *
-   * @param string $mode
-   *   The mode of operation: live or test.
-   *
-   * @param object $paymentProcessor
-   * @param null $paymentForm
-   * @param bool $force
-   *
-   * @return object
-   * @static
-   */
-  public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
-    if (!empty($paymentProcessor['id'])) {
-      $cacheKey = $paymentProcessor['id'];
-    }
-    else {
-      //@todo eliminated instances of this in favour of id-specific instances.
-      $cacheKey = $mode . '_' . $paymentProcessor['name'];
-    }
-    if (self::$_singleton[$cacheKey] === NULL) {
-      self::$_singleton[$cacheKey] = new CRM_Core_Payment_PaymentExpress($mode, $paymentProcessor);
-    }
-    return self::$_singleton[$cacheKey];
-  }
-
   /**
    * This function checks to see if we have the right config values
    *
    * @internal param string $mode the mode we are operating in (live or test)
    *
-   * @return string the error message if any
+   * @return string
+   *   the error message if any
    */
   public function checkConfig() {
     $config = CRM_Core_Config::singleton();
@@ -156,7 +129,8 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
    * @param array $params
    *   Assoc array of input parameters for this transaction.
    *
-   * @return array the result in an nice formatted array (or an error object)
+   * @return array
+   *   the result in an nice formatted array (or an error object)
    * @abstract
    */
   public function doDirectPayment(&$params) {
@@ -196,12 +170,12 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
     }
 
     /*
-         * Build the private data string to pass to DPS, which they will give back to us with the
-         *
-         * transaction result.  We are building this as a comma-separated list so as to avoid long URLs.
-         *
-         * Parameters passed: a=contactID, b=contributionID,c=contributionTypeID,d=invoiceID,e=membershipID,f=participantID,g=eventID
-         */
+     * Build the private data string to pass to DPS, which they will give back to us with the
+     *
+     * transaction result.  We are building this as a comma-separated list so as to avoid long URLs.
+     *
+     * Parameters passed: a=contactID, b=contributionID,c=contributionTypeID,d=invoiceID,e=membershipID,f=participantID,g=eventID
+     */
 
     $privateData = "a={$params['contactID']},b={$params['contributionID']},c={$params['contributionTypeID']},d={$params['invoiceID']}";
 
@@ -224,7 +198,7 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
       'MerchantReference' => $merchantRef,
       'TxnData1' => $params['qfKey'],
       'TxnData2' => $privateData,
-      'TxnData3' => $component . ",".$this->_paymentProcessor['id'],
+      'TxnData3' => $component . "," . $this->_paymentProcessor['id'],
       'TxnType' => 'Purchase',
       // Leave this empty for now, causes an error with DPS if we populate it
       'TxnId' => '',
@@ -235,8 +209,8 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
     CRM_Utils_Hook::alterPaymentProcessorParams($this, $params, $dpsParams);
 
     /*
-         *  determine whether method is pxaccess or pxpay by whether signature (mac key) is defined
-         */
+     *  determine whether method is pxaccess or pxpay by whether signature (mac key) is defined
+     */
 
     if (empty($this->_paymentProcessor['signature'])) {
       /*