@param        $rsp
@param        $txnType
@param string $returnType

@return mixed
421201
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentCreateSession')
    {
        $createSession = $rsp->Transaction->$txnType;

        $session = parent::fromDict($rsp, $txnType, $returnType);
        if (isset($createSession->Session)) {
            $pairs = self::nvpToArray($createSession->Session);
        }

        $session->sessionId = isset($pairs['SessionId']) ? $pairs['SessionId'] : null;
        $session->redirectUrl = isset($pairs['RedirectUrl']) ? $pairs['RedirectUrl'] : null;

        return $session;
    }
1005016
public function findBy($column, $value, $returnType = Table::RETURN_MODEL) {
        $return = $this->select(array(array(Util::camelTo_($column) => $value)),
                $returnType);
        if (is_a($return, 'DBScribe\Table')) $return = $return->execute();
        if (is_bool($return)) return new ArrayCollection();

        return $return;
    }
92396
protected static function valueByReturnType(
        $returnType,
        $tmpQuery,
        $result,
        $className,
        $dependency,
        $cacheLifetime = 86400
    )
    {
        switch ($returnType) {
            case Filter::RETURN_COUNT:
                $result += $className::getDb()->cache(
                    function ($db) use ($tmpQuery) {
                        return $tmpQuery->count('*', $db);
                    },
                    $cacheLifetime,
                    $dependency
                );

                break;
            case Filter::RETURN_QUERY:
                $result[$className] = $tmpQuery;
                break;
            default:
                if (!empty($tmpQuery)) {
                    $result = ArrayHelper::merge(
                        $result,
                        $className::getDb()->cache(
                            function ($db) use ($tmpQuery) {
                                return $tmpQuery->all($db);
                            },
                            $cacheLifetime,
                            $dependency
                        )
                    );
                }
        }
        return $result;
    }
947856
public static function fromDict($rsp, $txnType, $returnType = 'HpsGiftCardActivate')
    {
        $activationRsp = $rsp->Transaction->$txnType;

        $activation = new $returnType();

        $activation->transactionId = (string)$rsp->Header->GatewayTxnId;
        $activation->authorizationCode = (isset($activationRsp->AuthCode) ? (string)$activationRsp->AuthCode : null);
        $activation->balanceAmount = (isset($activationRsp->BalanceAmt) ? (string)$activationRsp->BalanceAmt : null);
        $activation->pointsBalanceAmount = (isset($activationRsp->PointsBalanceAmt) ? (string)$activationRsp->PointsBalanceAmt : null);
        $activation->rewards = (isset($activationRsp->Rewards) ? (string)$activationRsp->Rewards : null);
        $activation->notes = (isset($activationRsp->Notes) ? (string)$activationRsp->Notes : null);
        $activation->responseCode = (isset($activationRsp->RspCode) ? (string)$activationRsp->RspCode : null);
        $activation->responseText = (isset($activationRsp->RspText) ? (string)$activationRsp->RspText : null);

        return $activation;
    }
219728
public function find($id, $returnType = Table::RETURN_MODEL) {
        return $this->findBy($this->getPrimaryKey(), $id, $returnType);
    }
1368118
private function _submitTransaction($transaction, $txnType, $clientTxnId = null, $cardData = null)
    {
        $options = array();
        if ($clientTxnId !== null) {
            $options['clientTransactionId'] = $clientTxnId;
        }

        try {
            $response = $this->doRequest($transaction, $options);
        } catch (HpsException $e) {
            if ($e->innerException != null && $e->innerException->getMessage() == 'gateway_time-out') {
                if ($txnType == 'DebitSale') {
                    try {
                        $this->reverse($cardData, $this->_amount, $this->_currency);
                    } catch (Exception $e) {
                        throw new HpsGatewayException('0', HpsExceptionCodes::GATEWAY_TIMEOUT_REVERSAL_ERROR);
                    }
                }
                throw new HpsException('An error occurred and the gateway has timed out', 'gateway_timeout', $e, 'gateway_timeout');
            }
            throw $e;
        }

        $this->_processChargeGatewayResponse($response, $txnType);
        $this->_processChargeIssuerResponse($response, $txnType);

        $rvalue = null;
        switch ($txnType) {
            case 'DebitSale':
                $rvalue = HpsDebitSale::fromDict($response, $txnType);
                break;
            case 'DebitAddValue':
                $rvalue = HpsDebitAddValue::fromDict($response, $txnType);
                break;
            case 'DebitReturn':
                $rvalue = HpsDebitReturn::fromDict($response, $txnType);
                break;
            case 'DebitReversal':
                $rvalue = HpsDebitReversal::fromDict($response, $txnType);
                break;
            default:
                break;
        }

        return $rvalue;
    }
97924
protected function validateReturnTypeNotEmpty(
        File $file,
        $functionStart,
        $returnType,
        array $suggestedReturnTypes
    ) {
        $filteredReturnTypes = array_filter($suggestedReturnTypes);
        if (empty($returnType)
            && count($suggestedReturnTypes) == 1
            && count($filteredReturnTypes) == 1
        ) {
            $file->addWarning(
                sprintf(
                    'Method should have a return type in PHP7, use %s',
                    reset($filteredReturnTypes)
                ),
                $functionStart,
                'MissingReturnType'
            );
        }
    }
40359
public static function fromDict($rsp, $txnType, $returnType = 'HpsAttachment')
    {
        $attResponse = $rsp->Transaction->$txnType->Details;
        $transaction = parent::fromDict($rsp, $txnType, $returnType);
        foreach (get_object_vars($attResponse) as $key => $prop) {
            if (property_exists($transaction, lcfirst($key))) {
                $transaction->__set(lcfirst($key), $prop);
            }
        }
        return $transaction;
    }
651214
public static function fromObject($data, $returnType = 'HpsCardinalMPIAuthenticateResponse')
    {
        $response = parent::fromObject($data, $returnType);
        $response->authenticateMethod = self::readDataKey($data, 'AuthenticateMethod');
        $response->authorizationCode = self::readDataKey($data, 'AuthorizationCode');
        $response->cardBin = self::readDataKey($data, 'CardBin');
        $response->cardEnrollmentMethod = self::readDataKey($data, 'CardEnrollmentMethod');
        $response->cardExpMonth = self::readDataKey($data, 'CardExpMonth');
        $response->cardExpYear = self::readDataKey($data, 'CardExpYear');
        $response->cardLastFour = self::readDataKey($data, 'CardLastFour');
        $response->cardType = self::readDataKey($data, 'CardType');
        $response->cardTypeName = self::readDataKey($data, 'CardTypeName');
        $response->longAccessToken = self::readDataKey($data, 'LongAccessToken');
        $response->mastercardAssignedId = self::readDataKey($data, 'MasterCardAssignedId');
        $response->nameOnCard = self::readDataKey($data, 'NameOnCard');
        $response->paResStatus = self::readDataKey($data, 'PaResStatus');
        $response->payPassWalletIndicator = self::readDataKey($data, 'PayPassWalletIndicator');
        $response->paymentProcessorOrderNumber = self::readDataKey($data, 'PaymentProcessorOrderNumber');
        $response->processorBillingAddress1 = self::readDataKey($data, 'ProcessorBillingAddress1');
        $response->processorBillingAddress2 = self::readDataKey($data, 'ProcessorBillingAddress2');
        $response->processorBillingCity = self::readDataKey($data, 'ProcessorBillingCity');
        $response->processorBillingCountryCode = self::readDataKey($data, 'ProcessorBillingCountryCode');
        $response->processorBillingFirstName = self::readDataKey($data, 'ProcessorBillingFirstName');
        $response->processorBillingLastName = self::readDataKey($data, 'ProcessorBillingLastName');
        $response->processorBillingMiddleName = self::readDataKey($data, 'ProcessorBillingMiddleName');
        $response->processorBillingPhone = self::readDataKey($data, 'ProcessorBillingPhone');
        $response->processorBillingPostalCode = self::readDataKey($data, 'ProcessorBillingPostalCode');
        $response->processorBillingState = self::readDataKey($data, 'ProcessorBillingState');
        $response->processorCavv = self::readDataKey($data, 'ProcessorCavv');
        $response->processorEciFlag = self::readDataKey($data, 'ProcessorEciFlag');
        $response->processorEmail = self::readDataKey($data, 'ProcessorEmail');
        $response->processorPayresStatus = self::readDataKey($data, 'ProcessorPayresStatus');
        $response->processorShippingAddress1 = self::readDataKey($data, 'ProcessorShippingAddress1');
        $response->processorShippingAddress2 = self::readDataKey($data, 'ProcessorShippingAddress2');
        $response->processorShippingCity = self::readDataKey($data, 'ProcessorShippingCity');
        $response->processorShippingCountryCode = self::readDataKey($data, 'ProcessorShippingCountryCode');
        $response->processorShippingFullName = self::readDataKey($data, 'ProcessorShippingFullName');
        $response->processorShippingPhone = self::readDataKey($data, 'ProcessorShippingPhone');
        $response->processorShippingPostalCode = self::readDataKey($data, 'ProcessorShippingPostalCode');
        $response->processorShippingState = self::readDataKey($data, 'ProcessorShippingState');
        $response->processorSignatureVerification = self::readDataKey($data, 'ProcessorSignatureVerification');
        $response->processorXid = self::readDataKey($data, 'ProcessorXid');
        $response->rewardExpMonth = self::readDataKey($data, 'RewardExpMonth');
        $response->rewardExpYear = self::readDataKey($data, 'RewardExpYear');
        $response->rewardId = self::readDataKey($data, 'RewardId');
        $response->rewardName = self::readDataKey($data, 'RewardName');
        $response->rewardNumber = self::readDataKey($data, 'RewardNumber');
        $response->scEnrollmentStatus = self::readDataKey($data, 'ScEnrollmentStatus');
        $response->signatureVerification = self::readDataKey($data, 'SignatureVerification');
        return $response;
    }
1213366
private function getMySQLlistMultipleFinal($rChoice, $returnType, $additionalFeatures = null)
    {
        $qByChoice = [
            'Columns'         => ['sQueryMySqlColumns', $additionalFeatures],
            'Databases'       => ['sQueryMySqlActiveDatabases', $additionalFeatures],
            'Engines'         => ['sQueryMySqlActiveEngines', $additionalFeatures],
            'Indexes'         => ['sQueryMySqlIndexes', $additionalFeatures],
            'ServerTime'      => ['sQueryMySqlServerTime'],
            'Statistics'      => ['sQueryMySqlStatistics', $additionalFeatures],
            'Tables'          => ['sQueryMySqlTables', $additionalFeatures],
            'VariablesGlobal' => ['sQueryMySqlGlobalVariables'],
        ];
        if (array_key_exists($rChoice, $qByChoice)) {
            return $this->setMySQLquery2Server($this->transformStrIntoFn($qByChoice, $rChoice), $returnType)['result'];
        }
        return [];
    }
983684
private function _submitTransaction($transaction, $txnType, $clientTransactionId = null)
    {
        $options = array();
        if ($clientTransactionId !== null) {
            $options['clientTransactionId'] = $clientTransactionId;
        }
        $rsp = $this->doRequest($transaction, $options);
        HpsGatewayResponseValidation::checkResponse($rsp, $txnType);
        $response = HpsCheckResponse::fromDict($rsp, $txnType);

        if ($response->responseCode != 0) {
            throw new HpsCheckException(
                $rsp->Header->GatewayTxnId,
                $response->details,
                $response->responseCode,
                $response->responseText
            );
        }

        return $response;
    }
1327495
public function render($returnType = 'html')
	{
		$this->_remove();
		$this->_minLength();
		if (empty($this->orderBy)) {
			$this->_shuffle();
		} else {
			$orderDirection = strtolower($this->orderBy['direction']) == 'desc' ? 'SORT_DESC' : 'SORT_ASC';
			$this->_tagsArray = $this->_order(
				$this->_tagsArray,
				$this->orderBy['field'],
				$orderDirection
			);
		}
		$this->_limit();
		$max = $this->_getMax();
		if (count($this->_tagsArray)) {
			$return = ($returnType == 'html' ? '' : ($returnType == 'array' ? array() : ''));
			foreach ($this->_tagsArray as $tag => $arrayInfo) {
				$sizeRange = $this->_getClassFromPercent(($arrayInfo['size'] / $max) * 100);
				$arrayInfo['range'] = $sizeRange;
				if ($returnType == 'array') {
					$return [$tag] = $arrayInfo;
				} elseif ($returnType == 'html') {
					$return .= $this->htmlizeTag( $arrayInfo, $sizeRange );
				}
			}
			return $return;
		}
		return null;
	}
1204363
public static function fromObject($data, $returnType = 'HpsCardinalMPILookupResponse')
    {
        $response = parent::fromObject($data, $returnType);
        $response->acsUrl = self::readDataKey($data, 'ACSUrl');
        $response->enrolled = self::readDataKey($data, 'Enrolled');
        $response->payload = self::readDataKey($data, 'Payload');
        $response->processorTransactionIdPairing = self::readDataKey($data, 'ProcessorTransactionIdPairing');
        return $response;
    }
1277311
public static function fromDict($rsp, $txnType, $returnType = 'HpsReportTransactionDetails')
    {
        $reportResponse = $rsp->Transaction->$txnType;

        $details = parent::fromDict($rsp, $txnType, $returnType);
        $details->originalTransactionId = (isset($reportResponse->OriginalGatewayTxnId) ? (string)$reportResponse->OriginalGatewayTxnId : null);
        $details->authorizedAmount = (isset($reportResponse->Data->AuthAmt) ? (string)$reportResponse->Data->AuthAmt : null);
        $details->maskedCardNumber = (isset($reportResponse->Data->MaskedCardNbr) ? (string)$reportResponse->Data->MaskedCardNbr : null);
        $details->authorizationCode = (isset($reportResponse->Data->AuthCode) ? (string)$reportResponse->Data->AuthCode : null);
        $details->avsResultCode = (isset($reportResponse->Data->AVSRsltCode) ? (string)$reportResponse->Data->AVSRsltCode : null);
        $details->avsResultText = (isset($reportResponse->Data->AVSRsltText) ? (string)$reportResponse->Data->AVSRsltText : null);
        $details->cardType = (isset($reportResponse->Data->CardType) ? (string)$reportResponse->Data->CardType : null);
        $details->descriptor = (isset($reportResponse->Data->TxnDescriptor) ? (string)$reportResponse->Data->TxnDescriptor : null);
        $details->transactionType = (isset($reportResponse->ServiceName) ? HpsTransaction::serviceNameToTransactionType((string)$reportResponse->ServiceName) : null);
        $details->transactionUTCDate = (isset($reportResponse->RspUtcDT) ? (string)$reportResponse->RspUtcDT : null);
        $details->cpcIndicator = (isset($reportResponse->Data->CPCInd) ? (string)$reportResponse->Data->CPCInd : null);
        $details->cvvResultCode = (isset($reportResponse->Data->CVVRsltCode) ? (string)$reportResponse->Data->CVVRsltCode : null);
        $details->cvvResultText = (isset($reportResponse->Data->CVVRsltText) ? (string)$reportResponse->Data->CVVRsltText : null);
        $details->referenceNumber = (isset($reportResponse->Data->RefNbr) ? (string)$reportResponse->Data->RefNbr : null);
        $details->responseCode = (isset($reportResponse->Data->RspCode) ? (string)$reportResponse->Data->RspCode : null);
        $details->responseText = (isset($reportResponse->Data->RspText) ? (string)$reportResponse->Data->RspText : null);
        $details->transactionStatus = (isset($reportResponse->Data->TxnStatus) ? (string)$reportResponse->Data->TxnStatus : null);
        $details->gratuityAmount = (isset($reportResponse->Data->GratuityAmtInfo) ? (string)$reportResponse->Data->GratuityAmtInfo : null);
        $details->settlementAmount = (isset($reportResponse->Data->SettlementAmt) ? (string)$reportResponse->Data->SettlementAmt : null);
        $details->convenienceAmount = (isset($reportResponse->Data->ConvenienceAmtInfo) ? (string)$reportResponse->Data->ConvenienceAmtInfo : null);
        $details->shippingAmount = (isset($reportResponse->Data->ShippingAmtInfo) ? (string)$reportResponse->Data->ShippingAmtInfo : null);

        if (isset($reportResponse->Data->TokenizationMsg)) {
            $details->tokenData = new HpsTokenData();
            $details->tokenData->responseMessage = (string)$reportResponse->Data->TokenizationMsg;
        }

        if (isset($reportResponse->Data->AdditionalTxnFields)) {
            $additionalTxnFields = $reportResponse->Data->AdditionalTxnFields;
            $details->memo = (isset($additionalTxnFields->Description) ? (string)$additionalTxnFields->Description : null);
            $details->invoiceNumber = (isset($additionalTxnFields->InvoiceNbr) ? (string)$additionalTxnFields->InvoiceNbr : null);
            $details->customerId = (isset($additionalTxnFields->CustomerID) ? (string)$additionalTxnFields->CustomerID : null);
        }

        if ((string)$reportResponse->GatewayRspCode != '0' && (string)$reportResponse->Data->RspCode != '00') {
            if ($details->exceptions == null) {
                $details->exceptions = new HpsChargeExceptions();
            }

            $details->exceptions->issuerException = HpsIssuerResponseValidation::getException(
                (string)$rsp->Header->GatewayTxnId,
                (string)$reportResponse->Data->RspCode,
                (string)$reportResponse->Data->RspText,
                'credit'
            );
        }

        return $details;
    }
548532
private function buildEventAggregate(array $rows, $returnType)
    {
        if ($returnType === self::RETURN_AS_ARRAY) {
            return $this->buildEventAggregateAsArray($rows);
        }

        return $this->buildEventAggregateAsObject($rows);
    }
1325460
private function loadFixableTypes(?array $returnTypes): array
    {
        return array_filter($returnTypes ?? [], function (string $returnType): bool {
            return $this->isFixableReturnType($returnType);
        });
    }
709173
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentSessionInfo')
    {
        $sessionInfo = $rsp->Transaction->$txnType;
        $buyer     = self::nvpToArray($sessionInfo->Buyer);
        $payment   = self::nvpToArray($sessionInfo->Payment);
        $shipping  = self::nvpToArray($sessionInfo->Shipping->Address);
        $lineItems = self::nvpToArray($sessionInfo->LineItem->Detail);

        $session = parent::fromDict($rsp, $txnType, $returnType);
        $session->status = isset($sessionInfo->Status) ? (string)$sessionInfo->Status : null;

        $session->buyer = new HpsBuyerData();
        $session->buyer->emailAddress = isset($buyer['EmailAddress']) ? $buyer['EmailAddress'] : null;
        $session->buyer->payerId = isset($buyer['BuyerId']) ? $buyer['BuyerId'] : null;
        $session->buyer->status = isset($buyer['Status']) ? $buyer['Status'] : null;
        $session->buyer->countryCode = isset($buyer['CountryCode']) ? $buyer['CountryCode'] : null;
        $session->buyer->firstName = isset($buyer['FirstName']) ? $buyer['FirstName'] : null;
        $session->buyer->lastName = isset($buyer['LastName']) ? $buyer['LastName'] : null;

        $session->shipping = new HpsShippingInfo();
        $session->shipping->name = isset($shipping['ShipName']) ? $shipping['ShipName'] : null;
        $session->shipping->address = new HpsAddress();
        $session->shipping->address->address = isset($shipping['ShipAddress']) ? $shipping['ShipAddress'] : null;
        $session->shipping->address->city = isset($shipping['ShipCity']) ? $shipping['ShipCity'] : null;
        $session->shipping->address->state = isset($shipping['ShipState']) ? $shipping['ShipState'] : null;
        $session->shipping->address->zip = isset($shipping['ShipZip']) ? $shipping['ShipZip'] : null;
        $session->shipping->address->country = isset($shipping['ShipCountryCode']) ? $shipping['ShipCountryCode'] : null;

        $session->payment = new HpsPaymentData();
        $session->payment->subtotal = isset($payment['ItemAmount']) ? $payment['ItemAmount'] : null;
        $session->payment->shippingAmount = isset($payment['ShippingAmount']) ? $payment['ShippingAmount'] : null;
        $session->payment->taxAmount = isset($payment['TaxAmount']) ? $payment['TaxAmount'] : null;

        $session->lineItems = array();
        $lineItem = new HpsLineitem();
        $lineItem->name = isset($lineItems['Name']) ? $lineItems['Name'] : null;
        $lineItem->amount = isset($lineItems['Amount']) ? $lineItems['Amount'] : null;
        $lineItem->number = isset($lineItems['Number']) ? $lineItems['Number'] : null;
        $lineItem->quantity = isset($lineItems['Quantity']) ? $lineItems['Quantity'] : null;
        $lineItem->taxAmount = isset($lineItems['TaxAmount']) ? $lineItems['TaxAmount'] : null;

        return $session;
    }