INFRA-132 - Trailing commas for multiline arrays
[civicrm-core.git] / CRM / Core / Payment.php
index c6cd405655e5b9c7bcc98e81a9448501858e2856..c52693c8e8539a996224609d09aaaeba096ba1b3 100644 (file)
@@ -107,21 +107,21 @@ abstract class CRM_Core_Payment {
       return CRM_Core_DAO::$_nullObject;
     }
 
-    $cacheKey = "{$mode}_{$paymentProcessor['id']}_" . (int)isset($paymentForm);
+    $cacheKey = "{$mode}_{$paymentProcessor['id']}_" . (int) isset($paymentForm);
 
     if (!isset(self::$_singleton[$cacheKey]) || $force) {
       $config = CRM_Core_Config::singleton();
       $ext = CRM_Extension_System::singleton()->getMapper();
       if ($ext->isExtensionKey($paymentProcessor['class_name'])) {
         $paymentClass = $ext->keyToClass($paymentProcessor['class_name'], 'payment');
-        require_once ($ext->classToPath($paymentClass));
+        require_once $ext->classToPath($paymentClass);
       }
       else {
         $paymentClass = 'CRM_Core_' . $paymentProcessor['class_name'];
         if (empty($paymentClass)) {
           throw new CRM_Core_Exception('no class provided');
         }
-        require_once (str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php');
+        require_once str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php';
       }
 
       //load the object.
@@ -130,7 +130,7 @@ abstract class CRM_Core_Payment {
 
     //load the payment form for required processor.
     //if ($paymentForm !== NULL) {
-      //self::$_singleton[$cacheKey]->setForm($paymentForm);
+    //self::$_singleton[$cacheKey]->setForm($paymentForm);
     //}
 
     return self::$_singleton[$cacheKey];
@@ -315,7 +315,7 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 20,
           'maxlength' => 20,
-          'autocomplete' => 'off'
+          'autocomplete' => 'off',
         ),
         'is_required' => TRUE,
       ),
@@ -327,7 +327,7 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 5,
           'maxlength' => 10,
-          'autocomplete' => 'off'
+          'autocomplete' => 'off',
         ),
         'is_required' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,
           'cvv_backoffice_required',
@@ -371,7 +371,7 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 20,
           'maxlength' => 34,
-          'autocomplete' => 'on'
+          'autocomplete' => 'on',
         ),
         'is_required' => TRUE,
       ),
@@ -384,7 +384,7 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 20,
           'maxlength' => 34,
-          'autocomplete' => 'off'
+          'autocomplete' => 'off',
         ),
         'rules' => array(
           array(
@@ -403,7 +403,7 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 20,
           'maxlength' => 11,
-          'autocomplete' => 'off'
+          'autocomplete' => 'off',
         ),
         'is_required' => TRUE,
         'rules' => array(
@@ -421,11 +421,11 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 20,
           'maxlength' => 64,
-          'autocomplete' => 'off'
+          'autocomplete' => 'off',
         ),
         'is_required' => TRUE,
 
-      )
+      ),
     );
   }
 
@@ -596,10 +596,12 @@ abstract class CRM_Core_Payment {
       $extension_instance_found = TRUE;
     }
 
-    if (!$extension_instance_found) CRM_Core_Error::fatal(
-      "No extension instances of the '{$params['processor_name']}' payment processor were found.<br />" .
-      "$method method is unsupported in legacy payment processors."
-    );
+    if (!$extension_instance_found) {
+      CRM_Core_Error::fatal(
+        "No extension instances of the '{$params['processor_name']}' payment processor were found.<br />" .
+        "$method method is unsupported in legacy payment processors."
+      );
+    }
 
     // Exit here on web requests, allowing just the plain text response to be echoed
     if ($method == 'handlePaymentNotification') {
@@ -629,17 +631,19 @@ abstract class CRM_Core_Payment {
   public function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
     // Set URL
     switch ($action) {
-      case 'cancel' :
+      case 'cancel':
         $url = 'civicrm/contribute/unsubscribe';
         break;
-      case 'billing' :
+
+      case 'billing':
         //in notify mode don't return the update billing url
         if (!$this->isSupported('updateSubscriptionBillingInfo')) {
           return NULL;
         }
         $url = 'civicrm/contribute/updatebilling';
         break;
-      case 'update' :
+
+      case 'update':
         $url = 'civicrm/contribute/updaterecur';
         break;
     }
@@ -653,17 +657,17 @@ abstract class CRM_Core_Payment {
     // Find related Contact
     if ($entityID) {
       switch ($entity) {
-        case 'membership' :
+        case 'membership':
           $contactID = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $entityID, "contact_id");
           $entityArg = 'mid';
           break;
 
-        case 'contribution' :
+        case 'contribution':
           $contactID = CRM_Core_DAO::getFieldValue("CRM_Contribute_DAO_Contribution", $entityID, "contact_id");
           $entityArg = 'coid';
           break;
 
-        case 'recur' :
+        case 'recur':
           $sql = "
     SELECT con.contact_id
       FROM civicrm_contribution_recur rec