![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/Corals/modules/Payment/Fac/Message/ |
<?php namespace Corals\Modules\Payment\Fac\Message; use Corals\Modules\Payment\Common\Message\AbstractResponse as BaseAbstractResponse; use SimpleXMLElement; abstract class AbstractResponse extends BaseAbstractResponse { /** * Seserializes XML to an array * * @param \SimpleXMLElement|string $xml SimpleXMLElement object or a well formed xml string. * * @return array data */ protected function xmlDeserialize($xml) { $array = []; if (!$xml instanceof SimpleXMLElement) { $xml = new SimpleXMLElement($xml); } foreach ($xml->children() as $key => $child) { $value = (string)$child; $_children = $this->xmlDeserialize($child); $_push = ($_hasChild = (count($_children) > 0)) ? $_children : $value; if ($_hasChild && !empty($value) && $value !== '') { $_push[] = $value; } $array[$key] = $_push; } return $array; } /** * This is mostly for convenience so you can get the Transaction ID from the response which FAC sends back with all * of their responses except the Create Card. If you call this from CreateCardResponse, you will just get a null. * * @return null */ public function getTransactionId() { return isset($this->data['OrderNumber']) ? $this->data['OrderNumber'] : null; } public function getChargeReference() { return $this->getTransactionReference() ?: $this->getTransactionId(); } }