Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
thrift_33cn
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tufengqi
thrift_33cn
Commits
1444fa75
Commit
1444fa75
authored
Apr 20, 2018
by
tufengqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
651920a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1389 additions
and
1025 deletions
+1389
-1025
Calculator.php
Thrift/gen-php/tutorial/Calculator.php
+1035
-774
Types.php
Thrift/gen-php/tutorial/Types.php
+354
-251
No files found.
Thrift/gen-php/tutorial/Calculator.php
View file @
1444fa75
...
...
@@ -21,873 +21,1134 @@ use Thrift\Exception\TApplicationException;
* and can optionally inherit from another service using the extends keyword.
*/
interface
CalculatorIf
extends
\shared\SharedServiceIf
{
/**
* A method definition looks like C code. It has a return type, arguments,
* and optionally a list of exceptions that it may throw. Note that argument
* lists and exception lists are specified using the exact same syntax as
* field lists in struct or exception definitions.
*
*/
public
function
ping
();
/**
* @param int $num1
* @param int $num2
* @return int
*/
public
function
add
(
$num1
,
$num2
);
/**
* @param int $logid
* @param \tutorial\Work $w
* @return int
* @throws \tutorial\InvalidOperation
*/
public
function
calculate
(
$logid
,
\tutorial\Work
$w
);
/**
* This method has a oneway modifier. That means the client only makes
* a request and does not listen for any response at all. Oneway methods
* must be void.
*
*/
public
function
zip
();
/**
* A method definition looks like C code. It has a return type, arguments,
* and optionally a list of exceptions that it may throw. Note that argument
* lists and exception lists are specified using the exact same syntax as
* field lists in struct or exception definitions.
*
*/
public
function
ping
();
/**
* @param int $num1
* @param int $num2
* @return int
*/
public
function
add
(
$num1
,
$num2
);
/**
* @param \tutorial\MemberInfoRequest[] $requests
* @return int
*/
public
function
addList
(
array
$requests
);
/**
* @param int $logid
* @param \tutorial\Work $w
* @return int
* @throws \tutorial\InvalidOperation
*/
public
function
calculate
(
$logid
,
\tutorial\Work
$w
);
/**
* This method has a oneway modifier. That means the client only makes
* a request and does not listen for any response at all. Oneway methods
* must be void.
*
*/
public
function
zip
();
}
class
CalculatorClient
extends
\shared\SharedServiceClient
implements
\tutorial\CalculatorIf
{
public
function
__construct
(
$input
,
$output
=
null
)
{
parent
::
__construct
(
$input
,
$output
);
}
public
function
ping
()
{
$this
->
send_ping
();
$this
->
recv_ping
();
}
public
function
send_ping
()
{
$args
=
new
\tutorial\Calculator_ping_args
();
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
public
function
__construct
(
$input
,
$output
=
null
)
{
parent
::
__construct
(
$input
,
$output
);
}
public
function
ping
()
{
thrift_protocol_write_binary
(
$this
->
output_
,
'ping'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
$this
->
send_ping
();
$this
->
recv_ping
();
}
else
public
function
send_ping
()
{
$this
->
output_
->
writeMessageBegin
(
'ping'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_ping
()
{
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_ping_result'
,
$this
->
input_
->
isStrictRead
());
else
$args
=
new
\tutorial\Calculator_ping_args
();
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'ping'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'ping'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_ping
()
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_ping_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
return
;
}
public
function
add
(
$num1
,
$num2
)
{
$this
->
send_add
(
$num1
,
$num2
);
return
$this
->
recv_add
();
}
public
function
send_add
(
$num1
,
$num2
)
{
$args
=
new
\tutorial\Calculator_add_args
();
$args
->
num1
=
$num1
;
$args
->
num2
=
$num2
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_ping_result'
,
$this
->
input_
->
isStrictRead
());
else
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_ping_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
return
;
}
public
function
add
(
$num1
,
$num2
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'add'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
$this
->
send_add
(
$num1
,
$num2
);
return
$this
->
recv_add
();
}
else
public
function
send_add
(
$num1
,
$num2
)
{
$this
->
output_
->
writeMessageBegin
(
'add'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_add
()
{
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_add_result'
,
$this
->
input_
->
isStrictRead
());
else
$args
=
new
\tutorial\Calculator_add_args
();
$args
->
num1
=
$num1
;
$args
->
num2
=
$num2
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'add'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'add'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_add
()
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_add_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
throw
new
\Exception
(
"add failed: unknown result"
);
}
public
function
calculate
(
$logid
,
\tutorial\Work
$w
)
{
$this
->
send_calculate
(
$logid
,
$w
);
return
$this
->
recv_calculate
();
}
public
function
send_calculate
(
$logid
,
\tutorial\Work
$w
)
{
$args
=
new
\tutorial\Calculator_calculate_args
();
$args
->
logid
=
$logid
;
$args
->
w
=
$w
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_add_result'
,
$this
->
input_
->
isStrictRead
());
else
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_add_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
throw
new
\Exception
(
"add failed: unknown result"
);
}
public
function
addList
(
array
$requests
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'calculate'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
$this
->
send_addList
(
$requests
);
return
$this
->
recv_addList
();
}
else
public
function
send_addList
(
array
$requests
)
{
$this
->
output_
->
writeMessageBegin
(
'calculate'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_calculate
()
{
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_calculate_result'
,
$this
->
input_
->
isStrictRead
());
else
$args
=
new
\tutorial\Calculator_addList_args
();
$args
->
requests
=
$requests
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'addList'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'addList'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_addList
()
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_calculate_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
if
(
$result
->
ouch
!==
null
)
{
throw
$result
->
ouch
;
}
throw
new
\Exception
(
"calculate failed: unknown result"
);
}
public
function
zip
()
{
$this
->
send_zip
();
}
public
function
send_zip
()
{
$args
=
new
\tutorial\Calculator_zip_args
();
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_addList_result'
,
$this
->
input_
->
isStrictRead
());
else
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_addList_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
throw
new
\Exception
(
"addList failed: unknown result"
);
}
public
function
calculate
(
$logid
,
\tutorial\Work
$w
)
{
$this
->
send_calculate
(
$logid
,
$w
);
return
$this
->
recv_calculate
();
}
public
function
send_calculate
(
$logid
,
\tutorial\Work
$w
)
{
$args
=
new
\tutorial\Calculator_calculate_args
();
$args
->
logid
=
$logid
;
$args
->
w
=
$w
;
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'calculate'
,
TMessageType
::
CALL
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'calculate'
,
TMessageType
::
CALL
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
public
function
recv_calculate
()
{
thrift_protocol_write_binary
(
$this
->
output_
,
'zip'
,
TMessageType
::
ONEWAY
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
$bin_accel
=
(
$this
->
input_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary'
);
if
(
$bin_accel
)
$result
=
thrift_protocol_read_binary
(
$this
->
input_
,
'\tutorial\Calculator_calculate_result'
,
$this
->
input_
->
isStrictRead
());
else
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$this
->
input_
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
if
(
$mtype
==
TMessageType
::
EXCEPTION
)
{
$x
=
new
TApplicationException
();
$x
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
throw
$x
;
}
$result
=
new
\tutorial\Calculator_calculate_result
();
$result
->
read
(
$this
->
input_
);
$this
->
input_
->
readMessageEnd
();
}
if
(
$result
->
success
!==
null
)
{
return
$result
->
success
;
}
if
(
$result
->
ouch
!==
null
)
{
throw
$result
->
ouch
;
}
throw
new
\Exception
(
"calculate failed: unknown result"
);
}
else
public
function
zip
()
{
$this
->
output_
->
writeMessageBegin
(
'zip'
,
TMessageType
::
ONEWAY
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
$this
->
send_zip
();
}
public
function
send_zip
()
{
$args
=
new
\tutorial\Calculator_zip_args
();
$bin_accel
=
(
$this
->
output_
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$this
->
output_
,
'zip'
,
TMessageType
::
ONEWAY
,
$args
,
$this
->
seqid_
,
$this
->
output_
->
isStrictWrite
());
}
else
{
$this
->
output_
->
writeMessageBegin
(
'zip'
,
TMessageType
::
ONEWAY
,
$this
->
seqid_
);
$args
->
write
(
$this
->
output_
);
$this
->
output_
->
writeMessageEnd
();
$this
->
output_
->
getTransport
()
->
flush
();
}
}
}
}
// HELPER FUNCTIONS AND STRUCTURES
class
Calculator_ping_args
{
static
$isValidate
=
false
;
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
static
$_TSPEC
=
array
(
);
public
function
__construct
()
{
}
public
function
__construct
()
{
}
public
function
getName
()
{
return
'Calculator_ping_args'
;
}
public
function
getName
()
{
return
'Calculator_ping_args'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_ping_args'
);
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_ping_args'
);
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_ping_result
{
static
$isValidate
=
false
;
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
static
$_TSPEC
=
array
(
);
public
function
__construct
()
{
}
public
function
__construct
()
{
}
public
function
getName
()
{
return
'Calculator_ping_result'
;
}
public
function
getName
()
{
return
'Calculator_ping_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_ping_result'
);
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_ping_result'
);
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_add_args
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'num1'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'num2'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'num1'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'num2'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
);
/**
* @var int
*/
public
$num1
=
null
;
/**
* @var int
*/
public
$num2
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'num1'
]))
{
$this
->
num1
=
$vals
[
'num1'
];
}
if
(
isset
(
$vals
[
'num2'
]))
{
$this
->
num2
=
$vals
[
'num2'
];
}
}
}
public
function
getName
()
{
return
'Calculator_add_args'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
/**
* @var int
*/
public
$num1
=
null
;
/**
* @var int
*/
public
$num2
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'num1'
]))
{
$this
->
num1
=
$vals
[
'num1'
];
}
if
(
isset
(
$vals
[
'num2'
]))
{
$this
->
num2
=
$vals
[
'num2'
];
}
}
}
public
function
getName
()
{
return
'Calculator_add_args'
;
}
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num1
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num2
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_add_args'
);
if
(
$this
->
num1
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num1'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
num1
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
num2
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num2'
,
TType
::
I32
,
2
);
$xfer
+=
$output
->
writeI32
(
$this
->
num2
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num1
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num2
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_add_args'
);
if
(
$this
->
num1
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num1'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
num1
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
num2
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num2'
,
TType
::
I32
,
2
);
$xfer
+=
$output
->
writeI32
(
$this
->
num2
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_add_result
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
);
/**
* @var int
*/
public
$success
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
}
}
public
function
getName
()
{
return
'Calculator_add_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_add_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
I32
,
0
);
$xfer
+=
$output
->
writeI32
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_addList_args
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'requests'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
LST
,
'etype'
=>
TType
::
STRUCT
,
'elem'
=>
array
(
'type'
=>
TType
::
STRUCT
,
'class'
=>
'\tutorial\MemberInfoRequest'
,
),
),
);
/**
* @var int
*/
public
$success
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
}
}
public
function
getName
()
{
return
'Calculator_add_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
/**
* @var \tutorial\MemberInfoRequest[]
*/
public
$requests
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'requests'
]))
{
$this
->
requests
=
$vals
[
'requests'
];
}
}
}
public
function
getName
()
{
return
'Calculator_addList_args'
;
}
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_add_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
I32
,
0
);
$xfer
+=
$output
->
writeI32
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
LST
)
{
$this
->
requests
=
array
();
$_size0
=
0
;
$_etype3
=
0
;
$xfer
+=
$input
->
readListBegin
(
$_etype3
,
$_size0
);
for
(
$_i4
=
0
;
$_i4
<
$_size0
;
++
$_i4
)
{
$elem5
=
null
;
$elem5
=
new
\tutorial\MemberInfoRequest
();
$xfer
+=
$elem5
->
read
(
$input
);
$this
->
requests
[]
=
$elem5
;
}
$xfer
+=
$input
->
readListEnd
();
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_addList_args'
);
if
(
$this
->
requests
!==
null
)
{
if
(
!
is_array
(
$this
->
requests
))
{
throw
new
TProtocolException
(
'Bad type in structure.'
,
TProtocolException
::
INVALID_DATA
);
}
$xfer
+=
$output
->
writeFieldBegin
(
'requests'
,
TType
::
LST
,
1
);
{
$output
->
writeListBegin
(
TType
::
STRUCT
,
count
(
$this
->
requests
));
{
foreach
(
$this
->
requests
as
$iter6
)
{
$xfer
+=
$iter6
->
write
(
$output
);
}
}
$output
->
writeListEnd
();
}
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_addList_result
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
);
/**
* @var int
*/
public
$success
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
}
}
public
function
getName
()
{
return
'Calculator_addList_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_addList_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
I32
,
0
);
$xfer
+=
$output
->
writeI32
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_calculate_args
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'logid'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'w'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRUCT
,
'class'
=>
'\tutorial\Work'
,
),
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'logid'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'w'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRUCT
,
'class'
=>
'\tutorial\Work'
,
),
);
/**
* @var int
*/
public
$logid
=
null
;
/**
* @var \tutorial\Work
*/
public
$w
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'logid'
]))
{
$this
->
logid
=
$vals
[
'logid'
];
}
if
(
isset
(
$vals
[
'w'
]))
{
$this
->
w
=
$vals
[
'w'
];
}
}
}
public
function
getName
()
{
return
'Calculator_calculate_args'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
/**
* @var int
*/
public
$logid
=
null
;
/**
* @var \tutorial\Work
*/
public
$w
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'logid'
]))
{
$this
->
logid
=
$vals
[
'logid'
];
}
if
(
isset
(
$vals
[
'w'
]))
{
$this
->
w
=
$vals
[
'w'
];
}
}
}
public
function
getName
()
{
return
'Calculator_calculate_args'
;
}
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
logid
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
STRUCT
)
{
$this
->
w
=
new
\tutorial\Work
();
$xfer
+=
$this
->
w
->
read
(
$input
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_calculate_args'
);
if
(
$this
->
logid
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'logid'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
logid
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
w
!==
null
)
{
if
(
!
is_object
(
$this
->
w
))
{
throw
new
TProtocolException
(
'Bad type in structure.'
,
TProtocolException
::
INVALID_DATA
);
}
$xfer
+=
$output
->
writeFieldBegin
(
'w'
,
TType
::
STRUCT
,
2
);
$xfer
+=
$this
->
w
->
write
(
$output
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
logid
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
STRUCT
)
{
$this
->
w
=
new
\tutorial\Work
();
$xfer
+=
$this
->
w
->
read
(
$input
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_calculate_args'
);
if
(
$this
->
logid
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'logid'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
logid
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
w
!==
null
)
{
if
(
!
is_object
(
$this
->
w
))
{
throw
new
TProtocolException
(
'Bad type in structure.'
,
TProtocolException
::
INVALID_DATA
);
}
$xfer
+=
$output
->
writeFieldBegin
(
'w'
,
TType
::
STRUCT
,
2
);
$xfer
+=
$this
->
w
->
write
(
$output
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_calculate_result
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
1
=>
array
(
'var'
=>
'ouch'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRUCT
,
'class'
=>
'\tutorial\InvalidOperation'
,
),
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
0
=>
array
(
'var'
=>
'success'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
1
=>
array
(
'var'
=>
'ouch'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRUCT
,
'class'
=>
'\tutorial\InvalidOperation'
,
),
);
/**
* @var int
*/
public
$success
=
null
;
/**
* @var \tutorial\InvalidOperation
*/
public
$ouch
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
if
(
isset
(
$vals
[
'ouch'
]))
{
$this
->
ouch
=
$vals
[
'ouch'
];
}
}
}
public
function
getName
()
{
return
'Calculator_calculate_result'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
/**
* @var int
*/
public
$success
=
null
;
/**
* @var \tutorial\InvalidOperation
*/
public
$ouch
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'success'
]))
{
$this
->
success
=
$vals
[
'success'
];
}
if
(
isset
(
$vals
[
'ouch'
]))
{
$this
->
ouch
=
$vals
[
'ouch'
];
}
}
}
public
function
getName
()
{
return
'Calculator_calculate_result'
;
}
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
1
:
if
(
$ftype
==
TType
::
STRUCT
)
{
$this
->
ouch
=
new
\tutorial\InvalidOperation
();
$xfer
+=
$this
->
ouch
->
read
(
$input
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_calculate_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
I32
,
0
);
$xfer
+=
$output
->
writeI32
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
ouch
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'ouch'
,
TType
::
STRUCT
,
1
);
$xfer
+=
$this
->
ouch
->
write
(
$output
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
0
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
success
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
1
:
if
(
$ftype
==
TType
::
STRUCT
)
{
$this
->
ouch
=
new
\tutorial\InvalidOperation
();
$xfer
+=
$this
->
ouch
->
read
(
$input
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_calculate_result'
);
if
(
$this
->
success
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'success'
,
TType
::
I32
,
0
);
$xfer
+=
$output
->
writeI32
(
$this
->
success
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
ouch
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'ouch'
,
TType
::
STRUCT
,
1
);
$xfer
+=
$this
->
ouch
->
write
(
$output
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
Calculator_zip_args
{
static
$isValidate
=
false
;
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
static
$_TSPEC
=
array
(
);
public
function
__construct
()
{
}
public
function
__construct
()
{
}
public
function
getName
()
{
return
'Calculator_zip_args'
;
}
public
function
getName
()
{
return
'Calculator_zip_args'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_zip_args'
);
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Calculator_zip_args'
);
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
class
CalculatorProcessor
extends
\shared\SharedServiceProcessor
{
public
function
__construct
(
$handler
)
{
parent
::
__construct
(
$handler
);
}
public
function
process
(
$input
,
$output
)
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$input
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
$methodname
=
'process_'
.
$fname
;
if
(
!
method_exists
(
$this
,
$methodname
))
{
$input
->
skip
(
TType
::
STRUCT
);
$input
->
readMessageEnd
();
$x
=
new
TApplicationException
(
'Function '
.
$fname
.
' not implemented.'
,
TApplicationException
::
UNKNOWN_METHOD
);
$output
->
writeMessageBegin
(
$fname
,
TMessageType
::
EXCEPTION
,
$rseqid
);
$x
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
return
;
}
$this
->
$methodname
(
$rseqid
,
$input
,
$output
);
return
true
;
}
protected
function
process_ping
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_ping_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\tutorial\Calculator_ping_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_ping_result
();
$this
->
handler_
->
ping
();
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'ping'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
public
function
__construct
(
$handler
)
{
parent
::
__construct
(
$handler
);
}
else
{
$output
->
writeMessageBegin
(
'ping'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
protected
function
process_add
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_add_args'
,
$input
->
isStrictRead
());
public
function
process
(
$input
,
$output
)
{
$rseqid
=
0
;
$fname
=
null
;
$mtype
=
0
;
$input
->
readMessageBegin
(
$fname
,
$mtype
,
$rseqid
);
$methodname
=
'process_'
.
$fname
;
if
(
!
method_exists
(
$this
,
$methodname
))
{
$input
->
skip
(
TType
::
STRUCT
);
$input
->
readMessageEnd
();
$x
=
new
TApplicationException
(
'Function '
.
$fname
.
' not implemented.'
,
TApplicationException
::
UNKNOWN_METHOD
);
$output
->
writeMessageBegin
(
$fname
,
TMessageType
::
EXCEPTION
,
$rseqid
);
$x
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
return
;
}
$this
->
$methodname
(
$rseqid
,
$input
,
$output
);
return
true
;
}
else
{
$args
=
new
\tutorial\Calculator_add_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_add_result
();
$result
->
success
=
$this
->
handler_
->
add
(
$args
->
num1
,
$args
->
num2
);
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'add'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
protected
function
process_ping
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_ping_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\tutorial\Calculator_ping_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_ping_result
();
$this
->
handler_
->
ping
();
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'ping'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
}
else
{
$output
->
writeMessageBegin
(
'ping'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
else
{
$output
->
writeMessageBegin
(
'add'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
protected
function
process_calculate
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_calculate_args'
,
$input
->
isStrictRead
());
protected
function
process_add
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_add_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\tutorial\Calculator_add_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_add_result
();
$result
->
success
=
$this
->
handler_
->
add
(
$args
->
num1
,
$args
->
num2
);
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'add'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
}
else
{
$output
->
writeMessageBegin
(
'add'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
else
{
$args
=
new
\tutorial\Calculator_calculate_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_calculate_result
();
try
{
$result
->
success
=
$this
->
handler_
->
calculate
(
$args
->
logid
,
$args
->
w
);
}
catch
(
\tutorial\InvalidOperation
$ouch
)
{
$result
->
ouch
=
$ouch
;
}
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'calculate'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
protected
function
process_addList
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_addList_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\tutorial\Calculator_addList_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_addList_result
();
$result
->
success
=
$this
->
handler_
->
addList
(
$args
->
requests
);
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'addList'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
}
else
{
$output
->
writeMessageBegin
(
'addList'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
else
{
$output
->
writeMessageBegin
(
'calculate'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
protected
function
process_zip
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_zip_args'
,
$input
->
isStrictRead
());
protected
function
process_calculate
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_calculate_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\tutorial\Calculator_calculate_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$result
=
new
\tutorial\Calculator_calculate_result
();
try
{
$result
->
success
=
$this
->
handler_
->
calculate
(
$args
->
logid
,
$args
->
w
);
}
catch
(
\tutorial\InvalidOperation
$ouch
)
{
$result
->
ouch
=
$ouch
;
}
$bin_accel
=
(
$output
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_write_binary'
);
if
(
$bin_accel
)
{
thrift_protocol_write_binary
(
$output
,
'calculate'
,
TMessageType
::
REPLY
,
$result
,
$seqid
,
$output
->
isStrictWrite
());
}
else
{
$output
->
writeMessageBegin
(
'calculate'
,
TMessageType
::
REPLY
,
$seqid
);
$result
->
write
(
$output
);
$output
->
writeMessageEnd
();
$output
->
getTransport
()
->
flush
();
}
}
else
{
$args
=
new
\tutorial\Calculator_zip_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
protected
function
process_zip
(
$seqid
,
$input
,
$output
)
{
$bin_accel
=
(
$input
instanceof
TBinaryProtocolAccelerated
)
&&
function_exists
(
'thrift_protocol_read_binary_after_message_begin'
);
if
(
$bin_accel
)
{
$args
=
thrift_protocol_read_binary_after_message_begin
(
$input
,
'\tutorial\Calculator_zip_args'
,
$input
->
isStrictRead
());
}
else
{
$args
=
new
\tutorial\Calculator_zip_args
();
$args
->
read
(
$input
);
$input
->
readMessageEnd
();
}
$this
->
handler_
->
zip
();
return
;
}
$this
->
handler_
->
zip
();
return
;
}
}
Thrift/gen-php/tutorial/Types.php
View file @
1444fa75
...
...
@@ -22,171 +22,171 @@ use Thrift\Exception\TApplicationException;
* and start at 1 if not supplied, C style again.
*/
final
class
Operation
{
const
ADD
=
1
;
const
SUBTRACT
=
2
;
const
MULTIPLY
=
3
;
const
DIVIDE
=
4
;
static
public
$__names
=
array
(
1
=>
'ADD'
,
2
=>
'SUBTRACT'
,
3
=>
'MULTIPLY'
,
4
=>
'DIVIDE'
,
);
const
ADD
=
1
;
const
SUBTRACT
=
2
;
const
MULTIPLY
=
3
;
const
DIVIDE
=
4
;
static
public
$__names
=
array
(
1
=>
'ADD'
,
2
=>
'SUBTRACT'
,
3
=>
'MULTIPLY'
,
4
=>
'DIVIDE'
,
);
}
/**
* Structs are the basic complex data structures. They are comprised of fields
* which each have an integer identifier, a type, a symbolic name, and an
* optional default value.
*
*
* Fields can be declared "optional", which ensures they will not be included
* in the serialized output if they aren't set. Note that this requires some
* manual management in some languages.
*/
class
Work
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'num1'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'num2'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
3
=>
array
(
'var'
=>
'op'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
4
=>
array
(
'var'
=>
'comment'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'num1'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'num2'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
3
=>
array
(
'var'
=>
'op'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
4
=>
array
(
'var'
=>
'comment'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
);
/**
* @var int
*/
public
$num1
=
0
;
/**
* @var int
*/
public
$num2
=
null
;
/**
* @var int
*/
public
$op
=
null
;
/**
* @var string
*/
public
$comment
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'num1'
]))
{
$this
->
num1
=
$vals
[
'num1'
];
}
if
(
isset
(
$vals
[
'num2'
]))
{
$this
->
num2
=
$vals
[
'num2'
];
}
if
(
isset
(
$vals
[
'op'
]))
{
$this
->
op
=
$vals
[
'op'
];
}
if
(
isset
(
$vals
[
'comment'
]))
{
$this
->
comment
=
$vals
[
'comment'
];
}
}
}
public
function
getName
()
{
return
'Work'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num1
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num2
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
3
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
op
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
4
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
comment
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Work'
);
if
(
$this
->
num1
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num1'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
num1
);
$xfer
+=
$output
->
writeFieldEnd
();
/**
* @var int
*/
public
$num1
=
0
;
/**
* @var int
*/
public
$num2
=
null
;
/**
* @var int
*/
public
$op
=
null
;
/**
* @var string
*/
public
$comment
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'num1'
]))
{
$this
->
num1
=
$vals
[
'num1'
];
}
if
(
isset
(
$vals
[
'num2'
]))
{
$this
->
num2
=
$vals
[
'num2'
];
}
if
(
isset
(
$vals
[
'op'
]))
{
$this
->
op
=
$vals
[
'op'
];
}
if
(
isset
(
$vals
[
'comment'
]))
{
$this
->
comment
=
$vals
[
'comment'
];
}
}
}
if
(
$this
->
num2
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num2'
,
TType
::
I32
,
2
);
$xfer
+=
$output
->
writeI32
(
$this
->
num2
);
$xfer
+=
$output
->
writeFieldEnd
();
public
function
getName
()
{
return
'Work'
;
}
if
(
$this
->
op
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'op'
,
TType
::
I32
,
3
);
$xfer
+=
$output
->
writeI32
(
$this
->
op
);
$xfer
+=
$output
->
writeFieldEnd
();
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num1
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
num2
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
3
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
op
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
4
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
comment
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
if
(
$this
->
comment
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'comment'
,
TType
::
STRING
,
4
);
$xfer
+=
$output
->
writeString
(
$this
->
comment
);
$xfer
+=
$output
->
writeFieldEnd
();
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'Work'
);
if
(
$this
->
num1
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num1'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
num1
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
num2
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'num2'
,
TType
::
I32
,
2
);
$xfer
+=
$output
->
writeI32
(
$this
->
num2
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
op
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'op'
,
TType
::
I32
,
3
);
$xfer
+=
$output
->
writeI32
(
$this
->
op
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
comment
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'comment'
,
TType
::
STRING
,
4
);
$xfer
+=
$output
->
writeString
(
$this
->
comment
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
...
...
@@ -194,122 +194,225 @@ class Work {
* Structs can also be exceptions, if they are nasty.
*/
class
InvalidOperation
extends
TException
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'whatOp'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'why'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'whatOp'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I32
,
),
2
=>
array
(
'var'
=>
'why'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
STRING
,
),
);
/**
* @var int
*/
public
$whatOp
=
null
;
/**
* @var string
*/
public
$why
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'whatOp'
]))
{
$this
->
whatOp
=
$vals
[
'whatOp'
];
}
if
(
isset
(
$vals
[
'why'
]))
{
$this
->
why
=
$vals
[
'why'
];
}
/**
* @var int
*/
public
$whatOp
=
null
;
/**
* @var string
*/
public
$why
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'whatOp'
]))
{
$this
->
whatOp
=
$vals
[
'whatOp'
];
}
if
(
isset
(
$vals
[
'why'
]))
{
$this
->
why
=
$vals
[
'why'
];
}
}
}
}
public
function
getName
()
{
return
'InvalidOperation'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
public
function
getName
()
{
return
'InvalidOperation'
;
}
public
function
read
(
$input
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
whatOp
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
why
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I32
)
{
$xfer
+=
$input
->
readI32
(
$this
->
whatOp
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
STRING
)
{
$xfer
+=
$input
->
readString
(
$this
->
why
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'InvalidOperation'
);
if
(
$this
->
whatOp
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'whatOp'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
whatOp
);
$xfer
+=
$output
->
writeFieldEnd
();
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'InvalidOperation'
);
if
(
$this
->
whatOp
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'whatOp'
,
TType
::
I32
,
1
);
$xfer
+=
$output
->
writeI32
(
$this
->
whatOp
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
why
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'why'
,
TType
::
STRING
,
2
);
$xfer
+=
$output
->
writeString
(
$this
->
why
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
if
(
$this
->
why
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'why'
,
TType
::
STRING
,
2
);
$xfer
+=
$output
->
writeString
(
$this
->
why
);
$xfer
+=
$output
->
writeFieldEnd
();
}
class
MemberInfoRequest
{
static
$isValidate
=
false
;
static
$_TSPEC
=
array
(
1
=>
array
(
'var'
=>
'type_id'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I16
,
),
2
=>
array
(
'var'
=>
'id'
,
'isRequired'
=>
false
,
'type'
=>
TType
::
I64
,
),
);
/**
* 用户类型
*
* @var int
*/
public
$type_id
=
null
;
/**
* 用户ID
*
* @var int
*/
public
$id
=
null
;
public
function
__construct
(
$vals
=
null
)
{
if
(
is_array
(
$vals
))
{
if
(
isset
(
$vals
[
'type_id'
]))
{
$this
->
type_id
=
$vals
[
'type_id'
];
}
if
(
isset
(
$vals
[
'id'
]))
{
$this
->
id
=
$vals
[
'id'
];
}
}
}
public
function
getName
()
{
return
'MemberInfoRequest'
;
}
public
function
read
(
$input
)
{
$xfer
=
0
;
$fname
=
null
;
$ftype
=
0
;
$fid
=
0
;
$xfer
+=
$input
->
readStructBegin
(
$fname
);
while
(
true
)
{
$xfer
+=
$input
->
readFieldBegin
(
$fname
,
$ftype
,
$fid
);
if
(
$ftype
==
TType
::
STOP
)
{
break
;
}
switch
(
$fid
)
{
case
1
:
if
(
$ftype
==
TType
::
I16
)
{
$xfer
+=
$input
->
readI16
(
$this
->
type_id
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
case
2
:
if
(
$ftype
==
TType
::
I64
)
{
$xfer
+=
$input
->
readI64
(
$this
->
id
);
}
else
{
$xfer
+=
$input
->
skip
(
$ftype
);
}
break
;
default
:
$xfer
+=
$input
->
skip
(
$ftype
);
break
;
}
$xfer
+=
$input
->
readFieldEnd
();
}
$xfer
+=
$input
->
readStructEnd
();
return
$xfer
;
}
public
function
write
(
$output
)
{
$xfer
=
0
;
$xfer
+=
$output
->
writeStructBegin
(
'MemberInfoRequest'
);
if
(
$this
->
type_id
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'type_id'
,
TType
::
I16
,
1
);
$xfer
+=
$output
->
writeI16
(
$this
->
type_id
);
$xfer
+=
$output
->
writeFieldEnd
();
}
if
(
$this
->
id
!==
null
)
{
$xfer
+=
$output
->
writeFieldBegin
(
'id'
,
TType
::
I64
,
2
);
$xfer
+=
$output
->
writeI64
(
$this
->
id
);
$xfer
+=
$output
->
writeFieldEnd
();
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
$xfer
+=
$output
->
writeFieldStop
();
$xfer
+=
$output
->
writeStructEnd
();
return
$xfer
;
}
}
final
class
Constant
extends
\Thrift\Type\TConstant
{
static
protected
$INT32CONSTANT
;
static
protected
$MAPCONSTANT
;
static
protected
$INT32CONSTANT
;
static
protected
$MAPCONSTANT
;
static
protected
function
init_INT32CONSTANT
()
{
return
/**
* Thrift also lets you define constants for use across languages. Complex
* types and structs are specified using JSON notation.
*/
9853
;
}
static
protected
function
init_INT32CONSTANT
()
{
return
/**
* Thrift also lets you define constants for use across languages. Complex
* types and structs are specified using JSON notation.
*/
9853
;
}
static
protected
function
init_MAPCONSTANT
()
{
return
array
(
"hello"
=>
"world"
,
"goodnight"
=>
"moon"
,
);
}
static
protected
function
init_MAPCONSTANT
()
{
return
array
(
"hello"
=>
"world"
,
"goodnight"
=>
"moon"
,
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment