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

@return mixed
977174
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentResponse')
    {
        $response = $rsp->Transaction->$txnType;

        $altPayment = parent::fromDict($rsp, $txnType, $returnType);

        if ($response->RspCode != 0) {
            $error = self::nvpToArray($response->Processor->Response);
            $altPayment->error = new HpsProcessorError();
            $altPayment->error->code = isset($error['Code']) ? $error['Code'] : null;
            $altPayment->error->message = isset($error['Message']) ? $error['Message'] : null;
            $altPayment->error->type = isset($error['Type']) ? $error['Type'] : null;
        }

        return $altPayment;
    }
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 [];
    }
1137740
private function getMySQLlistMultiple($returnChoice, $returnType, $additionalFeatures = null)
    {
        if (is_null($this->mySQLconnection)) {
            if ($returnType == 'value') {
                return [];
            }
            return [];
        }
        return $this->getMySQLlistMultipleFinal($returnChoice, $returnType, $additionalFeatures);
    }
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;
    }
1166917
public static function fromDict($rsp, $txnType = null, $returnType = 'HpsManageTokensResponse')
    {
        $transaction = parent::fromDict($rsp, $txnType, $returnType);
        $transaction->responseCode = '00';
        $transaction->responseText = '';
        return $transaction;
    }
1238661
public function getRawDocuments($returnType)
  {
    if ($returnType == DOC_TYPE_ARRAY) {
      $res = array();
      foreach ($this->_documents as $key => $value) {
        $res[$key] = CPS_Response::simpleXmlToArray($value);
      }
      return $res;
    } else if ($returnType == DOC_TYPE_STDCLASS) {
      $res = array();
      foreach ($this->_documents as $key => $value) {
        $res[$key] = CPS_Response::simpleXmlToStdClass($value);
      }
      return $res;
    }
    return $this->_documents;
  }
1113446
public static function fromObject($data, $returnType = 'HpsCardinalMPIAuthorizeResponse')
    {
        $response = parent::fromObject($data, $returnType);
        $response->authorizationCode = self::readDataKey($data, 'AuthorizationCode');
        $response->avsResult = self::readDataKey($data, 'AvsResult');
        $response->cardBin = self::readDataKey($data, 'CardBin');
        $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->longAccessToken = self::readDataKey($data, 'LongAccessToken');
        $response->nameOnCard = self::readDataKey($data, 'NameOnCard');
        $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');
        return $response;
    }
228907
private boolean validReturnType(final String s) {
        ReturnType rt = ReturnType.getReturnType(s);
        if (rt != null) return true;
        return false;
    }
370489
public function returnData($data,$returnType = null,$option = null)
	{
		if(null === $returnType)
		{
			$returnType = Config::get('@.CONTROL_RETURN_TYPE');
		}
		$returnType = strtolower($returnType);
		if('json' === $returnType)
		{
			Response::setMime('json');
			exit(json_encode($data,null === $option?0:$option));
		}
		else if('xml' === $returnType)
		{
			Response::setMime('xml');
			exit(XML::toString($data));
		}
		else if('html' === $returnType)
		{
			Response::setMime('html');
			echo $data;
		}
		else
		{
			$eventData = array('data'=>$data,'returnType'=>$returnType,'option'=>$option);
			Event::trigger('YURUN_RETURN_DATA',$eventData);
		}
	}
888620
public function setReturnReceiptType(\Innova\CollecticielBundle\Entity\ReturnReceiptType $returnReceiptType = null)
    {
        $this->returnReceiptType = $returnReceiptType;

        return $this;
    }
904933
public function getReturnType(): Type
    {
        if (! isset($this->returnType)) {
            $this->returnType = app(DefinitionNodeConverter::class)->toType(
                $this->field->type
            );
        }

        return $this->returnType;
    }
837138
public function getRawAggregate($returnType)
  {
    if ($returnType == DOC_TYPE_ARRAY) {
      $res = array();
      foreach ($this->_aggregate as $key => $value) {
        if ($value) {
          $tmp = CPS_Response::simpleXmlToArray($value);
          // multiple or one result - returned data format should be the same!
          if (isset($tmp['data'][0])) {
            // multiple results
            $res[$key] = $tmp['data'];
          } else {
            // one result
            $res[$key][] = $tmp['data'];
          }
          unset($tmp);
        } else {
          $res[$key] = array();
        }
      }
      return $res;
    } else if ($returnType == DOC_TYPE_STDCLASS) {
      $res = array();
      foreach ($this->_aggregate as $key => $value) {
        if ($value) {
          $tmp = CPS_Response::simpleXmlToStdClass($value);
          $res[$key] = $tmp->data;
          unset($tmp);
        } else {
          $res[$key] = new stdClass();
        }
      }
      return $res;
    }
    return $this->_aggregate;
  }
775593
public static function fromDict($rsp, $txnType, $returnType = 'HpsGiftCardSale')
    {
        $item = $rsp->Transaction;

        $sale = parent::fromDict($rsp, $txnType, $returnType);
        $sale->splitTenderCardAmount = (isset($item->SplitTenderCardAmt) ? (string)$item->SplitTenderCardAmt : null);
        $sale->splitTenderBalanceDue = (isset($item->SplitTenderBalanceDueAmt) ? (string)$item->SplitTenderBalanceDueAmt : null);

        return $sale;
    }
657054
public function areReturnTypesNullCompatible($type = null)
    {
        if (\count($this->returnTypes)) {
            foreach ($this->returnTypes as $returnType => $definition) {
                switch ($returnType) {
                    case 'null':
                        return true;
                }
            }
        }

        return false;
    }
303746
public static function ChangeObjectType( $value, $returnType )
	{
		try
		{
			if ( $returnType->getTypeName() == Type::integer )
				return Integer::ToInteger( $value );
			if ( $returnType->getTypeName() == Type::object )
				return $value;
			return Convert::ChangeType( $value, $returnType, null );
		}
		catch ( FormatException $ex )
		{
			throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::FORG0001,
				array(
					$value,
					SequenceType::WithTypeCodeAndCardinality(SequenceType::GetXmlTypeCodeFromType( $returnType ), XmlTypeCardinality::One )
				)
			);
		}
		catch ( \OverflowException $ex )
		{
			throw XPath2Exception::withErrorCodeAndParams( "FOAR0002", Resources::FOAR0002,
				array(
					$value,
					SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromType( $returnType), XmlTypeCardinality::One )
				)
			);
		}
	}
1093496
public function search(SearchQuery $searchQuery, $returnType = BaseSearch::SEARCH_RESULT)
    {
        $response = static::newResponse($returnType);

        /** @var yii\db\ActiveRecord|SearchableEntity $mainEntityClassName */
        $mainEntityClassName = $searchQuery->mainEntityClassName;

        $activeQuery = $mainEntityClassName::find();

        $success = false;

        // combine query
        $e = new SearchEvent(
            $searchQuery,
            $returnType,
            $response,
            [
                'params' => [
                    'activeQuery' => &$activeQuery,
                ],
            ]
        );
        $this->trigger(self::EVENT_BEFORE_PAGINATION, $e);

        // Pagination
        $pages = $searchQuery->getPagination();
        if ($returnType !== BaseSearch::SEARCH_COUNT && $pages !== null) {
            if ($pages->totalCount === 0) {
                $pages->totalCount = (int) $activeQuery->count();
            }
            $searchQuery->limit = $pages->limit;
            $searchQuery->offset = $pages->offset;
        }

        $e = new SearchEvent(
            $searchQuery,
            $returnType,
            $response,
            [
                'params' => [
                    'activeQuery' => &$activeQuery,
                    'pages' => $pages,
                ],
            ]
        );
        $this->trigger(self::EVENT_AFTER_PAGINATION, $e);

        $response->searchQuery = $searchQuery;

        switch ($returnType) {
            case BaseSearch::SEARCH_COUNT:
                /** @var CountResponse $response */
                $response->count = (int) $activeQuery->count();
                $success = true;
                break;
            case BaseSearch::SEARCH_QUERY:
                /** @var QueryResponse $response */
                $response->query = $activeQuery;
                $success = true;
                break;
            case BaseSearch::SEARCH_RESULT_ARRAY:
            case BaseSearch::SEARCH_RESULT:
                /** @var ResultResponse $response */
                // query for debug
                $response->query = $activeQuery;
                if (is_object($pages)) {
                    $response->pages = $pages;
                }
                if ($returnType === BaseSearch::SEARCH_RESULT_ARRAY) {
                    $activeQuery->asArray(true);
                }
                $response->entities = $activeQuery->all();
                $e = new SearchEvent(
                    $searchQuery,
                    $returnType,
                    $response,
                    [
                        'params' => [
                            'activeQuery' => &$activeQuery,
                        ],
                    ]
                );
                $this->trigger(self::EVENT_AFTER_FIND, $e);
                $success = true;
                break;
            case BaseSearch::SEARCH_IDS:
                /** @var IdsResponse $response */
                $activeQuery->select(
                    array_map(
                        function ($item) use ($mainEntityClassName) {
                            return $mainEntityClassName::tableName() . '.' . $item;
                        },
                        $mainEntityClassName::primaryKey()
                    )
                );
                $response->ids = $activeQuery
                    ->distinct(true)
                    ->asArray(true)
                    ->column();
                $response->query = $activeQuery;
                $success = true;
                break;
        }

        return $response->end($success);
    }
164100
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentCapture')
    {
        $addToBatch = $rsp->Transaction->$txnType;

        $capture = parent::fromDict($rsp, $txnType, $returnType);

        $capture->status = isset($addToBatch->Status) ? (string)$addToBatch->Status : null;
        $capture->statusMessage = isset($addToBatch->StatusMessage) ? (string)$addToBatch->StatusMessage : null;

        return $capture;
    }