src/XdrModel/PathPaymentResult.php
public static function fromXdr(XdrBuffer $xdr)
    {
        $model = new PathPaymentResult();

        $rawErrorCode = $xdr->readInteger();
        $errorCodeMap = [
            '0' => 'success',
            '-1' => static::MALFORMED,
            '-2' => static::UNDERFUNDED,
            '-3' => static::SRC_NO_TRUST,
            '-4' => static::SRC_NOT_AUTHORIZED,
            '-5' => static::NO_DESTINATION,
            '-6' => static::NO_TRUST,
            '-7' => static::NOT_AUTHORIZED,
            '-8' => static::LINE_FULL,
            '-9' => static::NO_ISSUER,
            '-10' => static::TOO_FEW_OFFERS,
            '-11' => static::OFFER_CROSS_SELF,
            '-12' => static::OVER_SENDMAX,
        ];
        if (!isset($errorCodeMap[$rawErrorCode])) {
            throw new \ErrorException(sprintf('Unknown error code %s', $rawErrorCode));
        }

        // Do not store the "success" error code
        if ($errorCodeMap[$rawErrorCode] !== 'success') {
            $model->errorCode = $errorCodeMap[$rawErrorCode];
        }

        // special case: a "no issuer" error code means we need to parse a different
        // value from the XDR
        if ($errorCodeMap[$rawErrorCode] == self::NO_ISSUER) {
            $model->paidAsset = Asset::fromXdr($xdr);
        }
        // Normal XDR parsing https://github.com/stellar/stellar-core/blob/3c4e356803175f6c2645e4437881cf07522df94d/src/xdr/Stellar-transaction.x#L441
        else {
            $numOffersClaimed = $xdr->readUnsignedInteger();
            for ($i=0; $i < $numOffersClaimed; $i++) {
                $model->claimedOffers[] = ClaimOfferAtom::fromXdr($xdr);
            }

            // These fields are combined into a SimplePaymentResult in the XDR spec,
            // but it only appears to be used in one place so I'm leaving them as
            // separate fields for now
            $model->destination = AccountId::fromXdr($xdr);
            $model->paidAsset = Asset::fromXdr($xdr);
            $model->paidAmount = new StellarAmount(new BigInteger($xdr->readInteger64()));
        }

        return $model;
    }
public static function fromXdr(XdrBuffer $xdr)
    {
        $model = new PathPaymentResult();

        $rawErrorCode = $xdr->readInteger();
        $errorCodeMap = [
            '0' => 'success',
            '-1' => static::MALFORMED,
            '-2' => static::UNDERFUNDED,
            '-3' => static::SRC_NO_TRUST,
            '-4' => static::SRC_NOT_AUTHORIZED,
            '-5' => static::NO_DESTINATION,
            '-6' => static::NO_TRUST,
            '-7' => static::NOT_AUTHORIZED,
            '-8' => static::LINE_FULL,
            '-9' => static::NO_ISSUER,
            '-10' => static::TOO_FEW_OFFERS,
            '-11' => static::OFFER_CROSS_SELF,
            '-12' => static::OVER_SENDMAX,
        ];
        if (!isset($errorCodeMap[$rawErrorCode])) {
            throw new \ErrorException(sprintf('Unknown error code %s', $rawErrorCode));
        }

        // Do not store the "success" error code
        if ($errorCodeMap[$rawErrorCode] !== 'success') {
            $model->errorCode = $errorCodeMap[$rawErrorCode];
        }

        // special case: a "no issuer" error code means we need to parse a different
        // value from the XDR
        if ($errorCodeMap[$rawErrorCode] == self::NO_ISSUER) {
            $model->paidAsset = Asset::fromXdr($xdr);
        }
        // Normal XDR parsing https://github.com/stellar/stellar-core/blob/3c4e356803175f6c2645e4437881cf07522df94d/src/xdr/Stellar-transaction.x#L441
        else {
            $numOffersClaimed = $xdr->readUnsignedInteger();
            for ($i=0; $i < $numOffersClaimed; $i++) {
                $model->claimedOffers[] = ClaimOfferAtom::fromXdr($xdr);
            }

            // These fields are combined into a SimplePaymentResult in the XDR spec,
            // but it only appears to be used in one place so I'm leaving them as
            // separate fields for now
            $model->destination = AccountId::fromXdr($xdr);
            $model->paidAsset = Asset::fromXdr($xdr);
            $model->paidAmount = new StellarAmount(new BigInteger($xdr->readInteger64()));
        }

        return $model;
    }
@deprecated Do not call this method directly. Instead, use OperationResult::fromXdr

@param XdrBuffer $xdr
@return OperationResult|PaymentResult
@throws \ErrorException