git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove usages of 'each', as it is deprecated in php 7.2
[plcapi.git]
/
src
/
Encoder.php
diff --git
a/src/Encoder.php
b/src/Encoder.php
index
220ce88
..
735c3ed
100644
(file)
--- a/
src/Encoder.php
+++ b/
src/Encoder.php
@@
-36,8
+36,8
@@
class Encoder
switch ($xmlrpcVal->kindOf()) {
case 'scalar':
if (in_array('extension_api', $options)) {
switch ($xmlrpcVal->kindOf()) {
case 'scalar':
if (in_array('extension_api', $options)) {
- reset($xmlrpcVal->me);
-
list($typ, $val) = each
($xmlrpcVal->me);
+
$val =
reset($xmlrpcVal->me);
+
$typ = key
($xmlrpcVal->me);
switch ($typ) {
case 'dateTime.iso8601':
$xmlrpcVal->scalar = $val;
switch ($typ) {
case 'dateTime.iso8601':
$xmlrpcVal->scalar = $val;
@@
-63,11
+63,11
@@
class Encoder
$out = strtotime($out);
}
if (is_int($out)) {
$out = strtotime($out);
}
if (is_int($out)) {
- $result = new \Date
t
ime();
+ $result = new \Date
T
ime();
$result->setTimestamp($out);
return $result;
$result->setTimestamp($out);
return $result;
- } elseif (is_a($out, 'Date
tim
e')) {
+ } elseif (is_a($out, 'Date
TimeInterfac
e')) {
return $out;
}
}
return $out;
}
}
@@
-179,12
+179,11
@@
class Encoder
case 'object':
if (is_a($phpVal, 'PhpXmlRpc\Value')) {
$xmlrpcVal = $phpVal;
case 'object':
if (is_a($phpVal, 'PhpXmlRpc\Value')) {
$xmlrpcVal = $phpVal;
- } elseif (is_a($phpVal, 'DateTime')) {
+ } elseif (is_a($phpVal, 'DateTime
Interface
')) {
$xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
} else {
$arr = array();
$xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
} else {
$arr = array();
- reset($phpVal);
- while (list($k, $v) = each($phpVal)) {
+ foreach($phpVal as $k => $v) {
$arr[$k] = $this->encode($v, $options);
}
$xmlrpcVal = new Value($arr, Value::$xmlrpcStruct);
$arr[$k] = $this->encode($v, $options);
}
$xmlrpcVal = new Value($arr, Value::$xmlrpcStruct);