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

        $rawErrorCode = $xdr->readInteger();
        $errorCodeMap = [
            '0' => 'success',
            '-1' => static::MALFORMED,
            '-2' => static::NO_TRUST_LINE,
            '-3' => static::TRUST_NOT_REQUIRED,
            '-4' => static::CANT_REVOKE,
            '-5' => static::SELF_NOT_ALLOWED,
        ];
        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];
        }

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

        $rawErrorCode = $xdr->readInteger();
        $errorCodeMap = [
            '0' => 'success',
            '-1' => static::MALFORMED,
            '-2' => static::NO_TRUST_LINE,
            '-3' => static::TRUST_NOT_REQUIRED,
            '-4' => static::CANT_REVOKE,
            '-5' => static::SELF_NOT_ALLOWED,
        ];
        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];
        }

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

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