Handle the serialization of "multi payment" data.

@return string
434297
public function serialize(): void
    {
        $this->buffer->writeUInt16(count($this->transaction['asset']['payments']));

        foreach ($this->transaction['asset']['payments'] as $payment) {
            $this->buffer->writeUInt64($payment['amount']);
            $this->buffer->writeHex(Base58::decodeCheck($payment['recipientId'])->getHex());
        }
    }
1135865
public function serialize(): array {
        // base 64 encode
        $details = array_map(function($value) {
            return base64_encode($value);
        }, $this->details);

        // enrich with encryption type
        return $details + ['encryption' => $this->encryption];
    }
162073
public function serialize()
	{
		return serialize(array(	$this->pemFile,
								$this->passphrase,
								$this->endpointEnv,

								$this->isValidated,
								$this->description,
								$this->validFrom,
								$this->validTo));
	}
181052
public function serialize()
    {
        return serialize([$this->container, $this->userList, $this->database, $this->connection]);
    }
1198589
protected function get_data_to_serialize() {
		return array(
			'recipient'    => $this->recipient->ID,
			'message'      => $this->message,
			'subject'      => $this->subject,
			'strategy'     => $this->strategy,
			'manager'      => $this->manager->get_type(),
			'data_sources' => $this->data_sources
		);
	}
407870
public function _requestPayload()
    {
        $payload = [
            'authorization_code'    => $this->authorization,
            'amount'                => $this->amount,
            'reference'             => $this->transactionRef,
            'email'                 => $this->email,
        ];

        if (!empty($this->plan)) {
            $payload['plan'] = $this->plan;
        }

        return $this->toJson($payload);
    }
223581
public function getData()
    {
        $this->validate('transactionReference');

        $data = [
            'opcode'     => 1,
            'payment_id' => $this->getTransactionReference(),
            'token'      => $this->getRequestToken(),
        ];

        if ($this->getAmount()) {
            $data['amount'] = $this->getAmount();
        }

        return $data;
    }
832781
public function serialize()
    {
        $data = array(
            // Serialized data ID.
            self::VERSION,
            $this->_bytes,
            $this->_eol,
            $this->_hdrCharset,
            $this->_headers,
            $this->_metadata,
            $this->_mimeid,
            $this->_parts,
            $this->_status,
            $this->_transferEncoding
        );

        if (!empty($this->_contents)) {
            $data[] = $this->_readStream($this->_contents);
        }

        return serialize($data);
    }
567736
public function serialize(): void
    {
        $voteBytes = [];

        foreach ($this->transaction['asset']['votes'] as $vote) {
            $voteBytes[] = '+' === substr($vote, 0, 1)
                ? '01'.substr($vote, 1)
                : '00'.substr($vote, 1);
        }

        $this->buffer->writeUInt8(count($this->transaction['asset']['votes']));
        $this->buffer->writeHexBytes(implode('', $voteBytes));
    }
946790
protected function GetUserPaymentData()
    {
        parent::GetUserPaymentData();
        $oGlobal = TGlobal::instance();
        $aPossibleReturnParameterList = $this->GetIncomingPaymentParameter();
        $aReturnedParameter = $oGlobal->GetUserData();
        $aReturnedParameter = array_change_key_case($aReturnedParameter, CASE_UPPER);
        foreach ($aPossibleReturnParameterList as $sPossibleParameterName) {
            if (array_key_exists($sPossibleParameterName, $aReturnedParameter)) {
                $this->aPaymentUserData[$sPossibleParameterName] = $aReturnedParameter[$sPossibleParameterName];
            }
        }

        return $this->aPaymentUserData;
    }
332128
public function getData()
    {
        if ($transactionId = $this->httpRequest->query->get('mtid')) {
            $this->setTransactionId($transactionId);
        }

        if ($currency = $this->httpRequest->query->get('currency')) {
            $this->setCurrency($currency);
        }

        if ($amount = $this->httpRequest->query->get('amount')) {
            $this->setAmount($amount);
        }

        if ($subId = $this->httpRequest->query->get('subid')) {
            $this->setSubId($subId);
        }

        $this->validate(
            'username',
            'password',
            'transactionId',
            'currency',
            'amount'
        );

        $document = new \DOMDocument('1.0', 'utf-8');
        $document->formatOutput = false;
        $document->createElement('soapenv:Header');

        $envelope = $document->appendChild(
            $document->createElementNS('http://schemas.xmlsoap.org/soap/envelope/', 'soapenv:Envelope')
        );
        $envelope->setAttribute('xmlns:urn', 'urn:pscservice');

        $body = $envelope->appendChild(
            $document->createElement('soapenv:Body')
        );

        $debit = $body->appendChild(
            $document->createElement('urn:executeDebit')
        );

        $debit->appendChild(
            $document->createElement('urn:username', $this->getUsername())
        );

        $debit->appendChild(
            $document->createElement('urn:password', $this->getPassword())
        );

        $debit->appendChild(
            $document->createElement('urn:mtid', $this->getTransactionId())
        );

        $debit->appendChild(
            $document->createElement('urn:subId', $this->getSubId())
        );

        $debit->appendChild(
            $document->createElement('urn:amount', $this->getAmount())
        );

        $debit->appendChild(
            $document->createElement('urn:currency', $this->getCurrency())
        );

        $debit->appendChild(
            $document->createElement('urn:close', '1')
        );

        return $document->saveXML();
    }
352285
protected function _convertAdditionalData()
    {
        $details = @unserialize($this->getInfo()->getAdditionalData());

        if (is_array($details)) {
            $this->_billerCode = isset($details['biller_code']) ? (string) $details['biller_code'] : '';
            $this->_ref = isset($details['ref']) ? (string) $details['ref'] : '';
        } else {
            $this->_billerCode = '';
            $this->_ref = '';
        }

        return $this;
    }
97890
public function getData()
    {
        // make sure we have the mandatory fields
        $this->validate('email', 'language', 'amount', 'currency', 'details');

        // merchant details
        $data['pay_to_email'] = $this->getEmail();
        $data['language'] = $this->getLanguage();
        $data['recipient_description'] = $this->getRecipientDescription();
        $data['transaction_id'] = $this->getTransactionId();
        $data['return_url'] = $this->getReturnUrl();
        $data['return_url_text'] = $this->getReturnUrlText();
        $data['return_url_target'] = $this->getReturnUrlTarget();
        $data['cancel_url'] = $this->getCancelUrl();
        $data['cancel_url_target'] = $this->getCancelUrlTarget();
        $data['status_url'] = $this->getNotifyUrl();
        $data['status_url2'] = $this->getNotifyUrl2();
        $data['new_window_redirect'] = $this->getNewWindowRedirect() ? 1 : 0;
        $data['hide_login'] = $this->getHideLogin() ? 1 : 0;
        $data['confirmation_note'] = $this->getConfirmationNote();
        $data['logo_url'] = $this->getLogoUrl();
        $data['prepare_only'] = 1;
        $data['rid'] = $this->getReferralId();
        $data['ext_ref_id'] = $this->getExtReferralId();

        $merchantFields = $this->getMerchantFields();
        if (is_array($merchantFields)) {
            $data['merchant_fields'] = implode(',', array_keys($merchantFields));
            foreach ($merchantFields as $field => $value) {
                $data[$field] = $value;
            }
        }

        // customer details
        $data['pay_from_email'] = $this->getCustomerEmail();
        $data['title'] = $this->getCustomerTitle();
        $data['firstname'] = $this->getCustomerFirstName();
        $data['lastname'] = $this->getCustomerLastName();

        $customerBirthday = $this->getCustomerBirthday();
        if ($customerBirthday) {
            $data['date_of_birth'] = $customerBirthday->format('dmY');
        }

        $data['address'] = $this->getCustomerAddress1();
        $data['address2'] = $this->getCustomerAddress2();
        $data['phone_number'] = $this->getCustomerPhone();
        $data['postal_code'] = $this->getCustomerPostalCode();
        $data['city'] = $this->getCustomerCity();
        $data['state'] = $this->getCustomerState();
        $data['country'] = $this->getCustomerCountry();

        // payment details
        $data['amount'] = rtrim(rtrim($this->getAmount(), '0'), '.');
        $data['currency'] = $this->getCurrency();

        $amountDescriptions = $this->getAmountDescriptions();
        if (is_array($amountDescriptions)) {
            $counter = 2;
            foreach ($amountDescriptions as $description => $amount) {
                $data['amount' . $counter . '_description'] = $description;
                $data['amount' . $counter] = $amount;
                $counter++;
            }
        }

        $details = $this->getDetails();
        $counter = 1;
        foreach ($details as $description => $text) {
            $data['detail' . $counter . '_description'] = $description;
            $data['detail' . $counter . '_text'] = $text;
            $counter++;
        }

        // split gateway
        $paymentMethods = $this->getPaymentMethods();
        if (is_array($paymentMethods)) {
            $data['payment_methods'] = implode(',', $paymentMethods);
        }

        return $data;
    }
606239
public function serialize()
    {
        $data = serialize(
            [
                $this->ffmpegBinary,
                $this->movieFile,
                $this->output,
                $this->frameNumber,
                $this->provider,
            ]
        );

        return $data;
    }
420244
function serialize()
    {
        $data = array(
                     'version' => '2',
                     'handle' => $this->handle,
                     'secret' => base64_encode($this->secret),
                     'issued' => strval(intval($this->issued)),
                     'lifetime' => strval(intval($this->lifetime)),
                     'assoc_type' => $this->assoc_type
                     );

        assert(array_keys($data) == $this->assoc_keys);

        return Auth_OpenID_KVForm::fromArray($data);
    }
247434
private function serializePaymentDataB2BSberbank(PaymentDataB2bSberbank $paymentData)
    {
        $result = array(
            'type' => $paymentData->getType(),
        );

        if ($paymentData->getPaymentPurpose() !== null) {
            $result['payment_purpose'] = $paymentData->getPaymentPurpose();
        }

        if ($paymentData->getVatData() !== null) {
            $vatData = array(
                'type' => $paymentData->getVatData()->getType(),
            );

            if ($paymentData->getVatData()->getRate() !== null) {
                $vatData['rate'] = $paymentData->getVatData()->getRate();
            }

            if ($paymentData->getVatData()->getAmount() !== null) {
                $vatData['amount'] = $this->serializeAmount($paymentData->getVatData()->getAmount());
            }

            $result['vat_data'] = $vatData;
        }

        return $result;
    }
592632
public function serialize(): void
    {
        $delegateBytes = bin2hex($this->transaction['asset']['delegate']['username']);

        $this->buffer->writeUInt8(strlen($delegateBytes) / 2);
        $this->buffer->writeHexBytes($delegateBytes);
    }