Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php b/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php
- index eb7245d..a2e9035 100644
- --- a/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php
- +++ b/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php
- @@ -3,6 +3,7 @@
- namespace Symfony\Component\Serializer\Encoder;
- use Symfony\Component\Serializer\SerializerInterface;
- +use Symfony\Component\Serializer\SerializerAwareInterface;
- /*
- * This file is part of the Symfony framework.
- @@ -18,7 +19,7 @@ use Symfony\Component\Serializer\SerializerInterface;
- *
- * @author Jordi Boggiano <j.boggiano@seld.be>
- */
- -abstract class AbstractEncoder implements EncoderInterface
- +abstract class AbstractEncoder implements SerializerAwareInterface, EncoderInterface
- {
- protected $serializer;
- @@ -37,4 +38,4 @@ abstract class AbstractEncoder implements EncoderInterface
- {
- return $this->serializer;
- }
- -}
- \ No newline at end of file
- +}
- diff --git a/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php b/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php
- new file mode 100644
- index 0000000..ab49c69
- --- /dev/null
- +++ b/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php
- @@ -0,0 +1,32 @@
- +<?php
- +
- +namespace Symfony\Component\Serializer\Encoder;
- +
- +use Symfony\Component\Serializer\SerializerInterface;
- +
- +/*
- + * This file is part of the Symfony framework.
- + *
- + * (c) Fabien Potencier <fabien@symfony.com>
- + *
- + * This source file is subject to the MIT license that is bundled
- + * with this source code in the file LICENSE.
- + */
- +
- +/**
- + * Defines the interface of encoders
- + *
- + * @author Jordi Boggiano <j.boggiano@seld.be>
- + */
- +interface DecoderInterface
- +{
- + /**
- + * Decodes a string into PHP data
- + *
- + * @param string $data data to decode
- + * @param string $format format to decode from
- + * @return mixed
- + * @api
- + */
- + function decode($data, $format);
- +}
- diff --git a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php
- index b7401e0..e204440 100644
- --- a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php
- +++ b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php
- @@ -29,30 +29,4 @@ interface EncoderInterface
- * @api
- */
- function encode($data, $format);
- -
- - /**
- - * Decodes a string into PHP data
- - *
- - * @param string $data data to decode
- - * @param string $format format to decode from
- - * @return mixed
- - * @api
- - */
- - function decode($data, $format);
- -
- - /**
- - * Sets the owning Serializer object
- - *
- - * @param SerializerInterface $serializer
- - * @api
- - */
- - function setSerializer(SerializerInterface $serializer);
- -
- - /**
- - * Gets the owning Serializer object
- - *
- - * @return SerializerInterface
- - * @api
- - */
- - function getSerializer();
- }
- diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
- index 31e4b00..5ab6876 100644
- --- a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
- +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
- @@ -18,7 +18,7 @@ use Symfony\Component\Serializer\SerializerInterface;
- *
- * @author Jordi Boggiano <j.boggiano@seld.be>
- */
- -class JsonEncoder extends AbstractEncoder
- +class JsonEncoder extends AbstractEncoder implements DecoderInterface
- {
- /**
- * {@inheritdoc}
- diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
- index 2e0c0af..c465f1b 100644
- --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
- +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
- @@ -20,7 +20,7 @@ use Symfony\Component\Serializer\SerializerInterface;
- * @author John Wards <jwards@whiteoctober.co.uk>
- * @author Fabian Vogler <fabian@equivalence.ch>
- */
- -class XmlEncoder extends AbstractEncoder
- +class XmlEncoder extends AbstractEncoder implements DecoderInterface
- {
- private $dom;
- private $format;
- diff --git a/src/Symfony/Component/Serializer/SerializerAwareInterface.php b/src/Symfony/Component/Serializer/SerializerAwareInterface.php
- new file mode 100644
- index 0000000..625601e
- --- /dev/null
- +++ b/src/Symfony/Component/Serializer/SerializerAwareInterface.php
- @@ -0,0 +1,38 @@
- +<?php
- +
- +namespace Symfony\Component\Serializer;
- +
- +use Symfony\Component\Serializer\SerializerInterface;
- +
- +/*
- + * This file is part of the Symfony framework.
- + *
- + * (c) Fabien Potencier <fabien@symfony.com>
- + *
- + * This source file is subject to the MIT license that is bundled
- + * with this source code in the file LICENSE.
- + */
- +
- +/**
- + * Defines the interface of encoders
- + *
- + * @author Jordi Boggiano <j.boggiano@seld.be>
- + */
- +interface SerializerAwareInterface
- +{
- + /**
- + * Sets the owning Serializer object
- + *
- + * @param SerializerInterface $serializer
- + * @api
- + */
- + function setSerializer(SerializerInterface $serializer);
- +
- + /**
- + * Gets the owning Serializer object
- + *
- + * @return SerializerInterface
- + * @api
- + */
- + function getSerializer();
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement