src/Xdr/XdrEncoder.php
public static function optional(XdrEncodableInterface $value = null)
    {
        $bytes = '';

        if ($value !== null) {
            $bytes .= self::boolean(true);
            $bytes .= $value->toXdr();
        }
        else {
            $bytes .= self::boolean(false);
        }

        return $bytes;
    }
public static function optional(XdrEncodableInterface $value = null)
    {
        $bytes = '';

        if ($value !== null) {
            $bytes .= self::boolean(true);
            $bytes .= $value->toXdr();
        }
        else {
            $bytes .= self::boolean(false);
        }

        return $bytes;
    }
Encodes an optional data value as XDR.

Any non-null $value will be encoded and returned

@param XdrEncodableInterface $value
@return string