XRL
latest
Simple XML-RPC Library (both client and server)
Main Page
Classes
Files
Examples
File List
I8.php
1
<?php
2
/*
3
* This file is part of XRL, a simple XML-RPC Library for PHP.
4
*
5
* Copyright (c) 2012, XRL Team. All rights reserved.
6
* XRL is licensed under the 3-clause BSD License.
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
fpoirotte\XRL\Types
;
13
23
class
I8
extends
\fpoirotte\XRL\Types\AbstractInteger
24
{
26
const
XMLRPC_TYPE
=
'{http://ws.apache.org/xmlrpc/namespaces/extensions}i8'
;
27
29
const
INTEGER_BITS
= 64;
30
32
public
function
set
(
$value
)
33
{
34
try
{
35
// Try to use PHP's integer type to hold the value.
36
// This will only work on 64-bit versions of PHP.
37
parent::set(
$value
);
38
}
catch
(\InvalidArgumentException $e) {
39
// Try to use a GMP resource/object instead,
40
// but make sure the value does not overflow/underflow.
41
$value
= new \fpoirotte\XRL\Types\BigInteger(
$value
);
42
$gmp =
$value
->get();
43
if
(gmp_cmp($gmp,
"-9223372036854775808"
) < 0 || gmp_cmp($gmp,
"9223372036854775807"
) > 0) {
44
throw
$e;
45
}
46
$this->value =
$value
;
47
}
48
}
49
}
fpoirotte\XRL\Types\I8\XMLRPC_TYPE
const XMLRPC_TYPE
XML-RPC type for this class.
Definition:
I8.php:26
fpoirotte\XRL\Types\I8\INTEGER_BITS
const INTEGER_BITS
Integer size in bits.
Definition:
I8.php:29
fpoirotte\XRL\Types\AbstractType\$value
$value
Current value associated with this object.
Definition:
AbstractType.php:23
fpoirotte\XRL\Types
Definition:
AbstractCollection.php:12
fpoirotte\XRL\Types\AbstractInteger
Abstract class for fixed-length integer types.
Definition:
AbstractInteger.php:21
fpoirotte\XRL\Types\I8
The XML-RPC "i8" type.
Definition:
I8.php:23
src
Types
I8.php
Generated on Sat May 12 2018 09:01:17 for XRL by
1.8.11