[Seriliazer] [XmlEncoder] Optimize conditions
This commit is contained in:
parent
b6a9935314
commit
f11cc2de0b
@ -54,9 +54,10 @@ class XmlEncoder extends AbstractEncoder implements DecoderInterface
|
|||||||
public function decode($data, $format)
|
public function decode($data, $format)
|
||||||
{
|
{
|
||||||
$xml = simplexml_load_string($data);
|
$xml = simplexml_load_string($data);
|
||||||
if (!$xml->count() && !$xml->attributes()) {
|
if (!$xml->count()) {
|
||||||
|
if (!$xml->attributes()) {
|
||||||
return (string) $xml;
|
return (string) $xml;
|
||||||
} elseif (!$xml->count()) {
|
}
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($xml->attributes() as $attrkey => $attr) {
|
foreach ($xml->attributes() as $attrkey => $attr) {
|
||||||
$data['@'.$attrkey] = (string) $attr;
|
$data['@'.$attrkey] = (string) $attr;
|
||||||
|
Reference in New Issue
Block a user