updated core and modules
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ class ChainDecoder implements DecoderInterface
|
||||
*
|
||||
* @return DecoderInterface
|
||||
*
|
||||
* @throws RuntimeException if no decoder is found
|
||||
* @throws RuntimeException If no decoder is found.
|
||||
*/
|
||||
private function getDecoder($format)
|
||||
{
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ interface DecoderInterface
|
||||
*
|
||||
* @param string $data Data to decode
|
||||
* @param string $format Format name
|
||||
* @param array $context options that decoders have access to.
|
||||
* @param array $context options that decoders have access to
|
||||
*
|
||||
* The format parameter specifies which format the data is in; valid values
|
||||
* depend on the specific implementation. Authors implementing this interface
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ interface EncoderInterface
|
||||
*
|
||||
* @param mixed $data Data to encode
|
||||
* @param string $format Format name
|
||||
* @param array $context options that normalizers/encoders have access to.
|
||||
* @param array $context options that normalizers/encoders have access to
|
||||
*
|
||||
* @return scalar
|
||||
*
|
||||
|
||||
+8
-3
@@ -369,7 +369,10 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
||||
if (is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) {
|
||||
foreach ($data as $key => $data) {
|
||||
//Ah this is the magic @ attribute types.
|
||||
if (0 === strpos($key, '@') && is_scalar($data) && $this->isElementNameValid($attributeName = substr($key, 1))) {
|
||||
if (0 === strpos($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) {
|
||||
if (!is_scalar($data)) {
|
||||
$data = $this->serializer->normalize($data, $this->format, $this->context);
|
||||
}
|
||||
$parentNode->setAttribute($attributeName, $data);
|
||||
} elseif ($key === '#') {
|
||||
$append = $this->selectNodeType($parentNode, $data);
|
||||
@@ -461,6 +464,8 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
||||
* @param mixed $val
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
private function selectNodeType(\DOMNode $node, $val)
|
||||
{
|
||||
@@ -472,7 +477,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
||||
} elseif ($val instanceof \Traversable) {
|
||||
$this->buildXml($node, $val);
|
||||
} elseif (is_object($val)) {
|
||||
return $this->buildXml($node, $this->serializer->normalize($val, $this->format, $this->context));
|
||||
return $this->selectNodeType($node, $this->serializer->normalize($val, $this->format, $this->context));
|
||||
} elseif (is_numeric($val)) {
|
||||
return $this->appendText($node, (string) $val);
|
||||
} elseif (is_string($val) && $this->needsCdataWrapping($val)) {
|
||||
@@ -506,7 +511,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
||||
/**
|
||||
* Create a DOM document, taking serializer options into account.
|
||||
*
|
||||
* @param array $context options that the encoder has access to.
|
||||
* @param array $context options that the encoder has access to
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user