26 return gmp_strval($this->value);
32 $size = static::INTEGER_BITS;
36 if ((is_resource(
$value) && get_resource_type(
$value) ===
'GMP integer') ||
37 (
$value instanceof \GMP)) {
43 throw new \InvalidArgumentException(
"Expected a signed $size-bits integer value");
47 $binval = gmp_strval(
$value, 2);
48 if (!strncmp($binval,
'-1', 2)) {
49 $binval = (string) substr($binval, 2);
51 if (strlen($binval) >= $size) {
52 throw new \InvalidArgumentException(
"Expected a signed $size-bits integer value");
55 $this->value = ($size <= 32) ? gmp_intval(
$value) :
$value;
59 public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
61 if (strpos(static::XMLRPC_TYPE,
'}') !==
false) {
62 list($ns, $tagName) = explode(
'}', static::XMLRPC_TYPE, 2);
63 $ns = (string) substr($ns, 1);
64 return $writer->writeElementNS(
'ex', $tagName, $ns, gmp_strval($this->value));
66 return $writer->writeElement(static::XMLRPC_TYPE, gmp_strval($this->value));
write(\XMLWriter $writer,\DateTimeZone $timezone, $stringTag)
$value
Current value associated with this object.
A class representing an abstract XML-RPC type.
Abstract class for fixed-length integer types.