protected $_mode = NULL;
- protected $_params = array();
+ protected $_params = [];
/**
* We only need one instance of this object. So we use the singleton
public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
- $this->_processorName = ts('Realex');
$this->_setParam('merchant_ref', $paymentProcessor['user_name']);
$this->_setParam('secret', $paymentProcessor['password']);
return self::error(9002, ts('Could not initiate connection to payment gateway'));
}
- curl_setopt($submit, CURLOPT_HTTPHEADER, array('SOAPAction: ""'));
+ curl_setopt($submit, CURLOPT_HTTPHEADER, ['SOAPAction: ""']);
curl_setopt($submit, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($submit, CURLOPT_TIMEOUT, 60);
curl_setopt($submit, CURLOPT_SSL_VERIFYPEER, Civi::settings()->get('verifySSL'));
// FIXME: We are using the trxn_result_code column to store all these extra details since there
// seems to be nowhere else to put them. This is THE WRONG THING TO DO!
- $extras = array(
+ $extras = [
'authcode' => $response['AUTHCODE'],
'batch_id' => $response['BATCHID'],
'message' => $response['MESSAGE'],
'trxn_result_code' => $response['RESULT'],
- );
+ ];
$params['trxn_id'] = $response['PASREF'];
$params['trxn_result_code'] = serialize($extras);
* An array of the result with following keys:
*/
public function xml_parse_into_assoc($xml) {
- $input = array();
- $result = array();
+ $input = [];
+ $result = [];
$result['#error'] = FALSE;
$result['#return'] = NULL;
}
else {
$result['#error'] = ts('Error parsing XML result - error code = %1 at line %2 char %3',
- array(
+ [
1 => xml_get_error_code($xmlparser),
2 => xml_get_current_line_number($xmlparser),
3 => xml_get_current_column_number($xmlparser),
- )
+ ]
);
}
}
* @return array
*/
public function _xml_parse($input, $depth = 1) {
- $output = array();
- $children = array();
+ $output = [];
+ $children = [];
foreach ($input as $data) {
if ($data['level'] == $depth) {
switch ($data['type']) {
case 'complete':
- $output[$data['tag']] = isset($data['value']) ? $data['value'] : '';
+ $output[$data['tag']] = $data['value'] ?? '';
break;
case 'open':
- $children = array();
+ $children = [];
break;
case 'close':
$this->_setParam('country', $params['country']);
$this->_setParam('post_code', $params['postal_code']);
$this->_setParam('order_id', $params['invoiceID']);
- $params['issue_number'] = (isset($params['issue_number']) ? $params['issue_number'] : '');
+ $params['issue_number'] = ($params['issue_number'] ?? '');
$this->_setParam('issue_number', $params['issue_number']);
$this->_setParam('varref', $params['contributionType_name']);
$comment = $params['description'] . ' (page id:' . $params['contributionPageID'] . ')';
* the error message if any
*/
public function checkConfig() {
- $error = array();
+ $error = [];
if (empty($this->_paymentProcessor['user_name'])) {
$error[] = ts('Merchant ID is not set for this payment processor');
}