Skip to content

Commit

Permalink
CRM-15771 remove obsolete singleton functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jan 7, 2015
1 parent 51754eb commit 204c86d
Show file tree
Hide file tree
Showing 16 changed files with 3 additions and 358 deletions.
30 changes: 0 additions & 30 deletions CRM/Core/Payment/AuthorizeNet.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_setParam('sequence', rand(1, 1000));
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
* @param array $paymentProcessor
* The details of the payment processor being invoked.
* @param CRM_Core_Form $paymentForm
* Reference to the form object if available.
* @param bool $force
* Should we force a reload of this payment object.
*
* @return object
* @static
*
*/
public static function &singleton($mode, &$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 (!isset(self::$_singleton[$cacheKey]) || self::$_singleton[$cacheKey] === NULL) {
self::$_singleton[$cacheKey] = new CRM_Core_Payment_AuthorizeNet($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**
* Should the first payment date be configurable when setting up back office recurring payments
* In the case of Authorize.net this is an option
Expand Down
27 changes: 0 additions & 27 deletions CRM/Core/Payment/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_processorName = ts('Dummy Processor');
}

/**
* 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, &$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 (CRM_Utils_Array::value($cacheKey, self::$_singleton) === NULL) {
self::$_singleton[$cacheKey] = new CRM_Core_Payment_Dummy($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**
* Submit a payment using Advanced Integration Method
*
Expand Down
25 changes: 0 additions & 25 deletions CRM/Core/Payment/Elavon.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_processorName = ts('Elavon');
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
*
* @param object $paymentProcessor
*
* @return object
* @static
*/
public static function &singleton($mode, &$paymentProcessor) {
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_Elavon($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**********************************************************
* This function is set up and put here to make the mapping of fields
* from the params object as visually clear as possible for easy editing
Expand Down
25 changes: 0 additions & 25 deletions CRM/Core/Payment/FirstData.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_paymentProcessor = $paymentProcessor;
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
*
* @param object $paymentProcessor
*
* @return object
* @static
*/
public static function &singleton($mode, &$paymentProcessor) {
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_FirstData($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**********************************************************
* This function is set up and put here to make the mapping of fields
* from the params object as visually clear as possible for easy editing
Expand Down
25 changes: 0 additions & 25 deletions CRM/Core/Payment/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_processorName = ts('Google Checkout');
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
*
* @param object $paymentProcessor
*
* @return object
* @static
*/
public static function &singleton($mode, &$paymentProcessor) {
if (!empty($paymentProcessor['id'])) {
$cacheKey = $paymentProcessor['id'];
}
else {
//@todo eliminated instances of this in favour of id-specific instances.
$cacheKey = $mode . '_' . $paymentProcessor['name'];
}
if (!isset(self::$_singleton[$cacheKey]) || self::$_singleton[$cacheKey] === NULL) {
self::$_singleton[$cacheKey] = new CRM_Core_Payment_Google($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**
* This function checks to see if we have the right config values
*
Expand Down
2 changes: 2 additions & 0 deletions CRM/Core/Payment/GoogleIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ public function completeRecur($input, $ids, $objects) {
}

/**
* @deprecated
* Payment processor singletons removed - this is an IPN so left but probably can go
* Singleton function used to manage this object
*
* @param string $mode
Expand Down
21 changes: 0 additions & 21 deletions CRM/Core/Payment/IATS.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,6 @@ public function __construct($mode, &$paymentProcessor) {
}
}

/**
* @param string $mode
* @param array $paymentProcessor
*
* @return mixed
*/
public static function &singleton($mode, &$paymentProcessor) {
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_IATS($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**
* This function collects all the information from a web/api form and invokes
* the relevant payment processor specific functions to perform the transaction
Expand Down
25 changes: 0 additions & 25 deletions CRM/Core/Payment/Moneris.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,6 @@ public function __construct($mode, &$paymentProcessor, &$paymentForm = NULL, $fo
}
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
*
* @param object $paymentProcessor
*
* @return object
* @static
*/
public static function &singleton($mode, &$paymentProcessor) {
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_Moneris($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**
* This function collects all the information from a web/api form and invokes
* the relevant payment processor specific functions to perform the transaction
Expand Down
27 changes: 0 additions & 27 deletions CRM/Core/Payment/PayJunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_processorName = ts('PayJunction');
}

/**
* 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, &$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_PayJunction($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/*
* This function sends request and receives response from
* PayJunction payment process
Expand Down
27 changes: 0 additions & 27 deletions CRM/Core/Payment/PayPalImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,6 @@ public function __construct($mode, &$paymentProcessor) {
}
}

/**
* 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, &$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 (!isset(self::$_singleton[$cacheKey]) || self::$_singleton[$cacheKey] === NULL) {
self::$_singleton[$cacheKey] = new CRM_Core_Payment_PaypalImpl($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/**
* Are back office payments supported - e.g paypal standard won't permit you to enter a credit card associated with someone else's login
* @return bool
Expand Down
25 changes: 0 additions & 25 deletions CRM/Core/Payment/PayflowPro.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_processorName = ts('Payflow Pro');
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
*
* @param object $paymentProcessor
*
* @return object
* @static
*/
public static function &singleton($mode, &$paymentProcessor) {
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_PayflowPro($mode, $paymentProcessor);
}
return self::$_singleton[$cacheKey];
}

/*
* This function sends request and receives response from
* the processor. It is the main function for processing on-server
Expand Down
27 changes: 0 additions & 27 deletions CRM/Core/Payment/PaymentExpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,6 @@ public function __construct($mode, &$paymentProcessor) {
$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
*
Expand Down
20 changes: 0 additions & 20 deletions CRM/Core/Payment/PaymentExpressIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,6 @@ public function __construct($mode, &$paymentProcessor) {
$this->_paymentProcessor = $paymentProcessor;
}

/**
* Singleton function used to manage this object
*
* @param string $mode
* The mode of operation: live or test.
*
* @param $paymentProcessor
* @param null $paymentForm
* @param bool $force
*
* @return object
* @static
*/
public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_Payment_PaymentExpressIPN($mode, $paymentProcessor);
}
return self::$_singleton;
}

/**
* The function gets called when a new order takes place.
*
Expand Down
Loading

0 comments on commit 204c86d

Please sign in to comment.