Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 KB | None | 0 0
  1. diff --git a/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php b/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php
  2. index eb7245d..a2e9035 100644
  3. --- a/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php
  4. +++ b/src/Symfony/Component/Serializer/Encoder/AbstractEncoder.php
  5. @@ -3,6 +3,7 @@
  6. namespace Symfony\Component\Serializer\Encoder;
  7.  
  8. use Symfony\Component\Serializer\SerializerInterface;
  9. +use Symfony\Component\Serializer\SerializerAwareInterface;
  10.  
  11. /*
  12. * This file is part of the Symfony framework.
  13. @@ -18,7 +19,7 @@ use Symfony\Component\Serializer\SerializerInterface;
  14. *
  15. * @author Jordi Boggiano <j.boggiano@seld.be>
  16. */
  17. -abstract class AbstractEncoder implements EncoderInterface
  18. +abstract class AbstractEncoder implements SerializerAwareInterface, EncoderInterface
  19. {
  20. protected $serializer;
  21.  
  22. @@ -37,4 +38,4 @@ abstract class AbstractEncoder implements EncoderInterface
  23. {
  24. return $this->serializer;
  25. }
  26. -}
  27. \ No newline at end of file
  28. +}
  29. diff --git a/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php b/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php
  30. new file mode 100644
  31. index 0000000..ab49c69
  32. --- /dev/null
  33. +++ b/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php
  34. @@ -0,0 +1,32 @@
  35. +<?php
  36. +
  37. +namespace Symfony\Component\Serializer\Encoder;
  38. +
  39. +use Symfony\Component\Serializer\SerializerInterface;
  40. +
  41. +/*
  42. + * This file is part of the Symfony framework.
  43. + *
  44. + * (c) Fabien Potencier <fabien@symfony.com>
  45. + *
  46. + * This source file is subject to the MIT license that is bundled
  47. + * with this source code in the file LICENSE.
  48. + */
  49. +
  50. +/**
  51. + * Defines the interface of encoders
  52. + *
  53. + * @author Jordi Boggiano <j.boggiano@seld.be>
  54. + */
  55. +interface DecoderInterface
  56. +{
  57. + /**
  58. + * Decodes a string into PHP data
  59. + *
  60. + * @param string $data data to decode
  61. + * @param string $format format to decode from
  62. + * @return mixed
  63. + * @api
  64. + */
  65. + function decode($data, $format);
  66. +}
  67. diff --git a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php
  68. index b7401e0..e204440 100644
  69. --- a/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php
  70. +++ b/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php
  71. @@ -29,30 +29,4 @@ interface EncoderInterface
  72. * @api
  73. */
  74. function encode($data, $format);
  75. -
  76. - /**
  77. - * Decodes a string into PHP data
  78. - *
  79. - * @param string $data data to decode
  80. - * @param string $format format to decode from
  81. - * @return mixed
  82. - * @api
  83. - */
  84. - function decode($data, $format);
  85. -
  86. - /**
  87. - * Sets the owning Serializer object
  88. - *
  89. - * @param SerializerInterface $serializer
  90. - * @api
  91. - */
  92. - function setSerializer(SerializerInterface $serializer);
  93. -
  94. - /**
  95. - * Gets the owning Serializer object
  96. - *
  97. - * @return SerializerInterface
  98. - * @api
  99. - */
  100. - function getSerializer();
  101. }
  102. diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
  103. index 31e4b00..5ab6876 100644
  104. --- a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
  105. +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
  106. @@ -18,7 +18,7 @@ use Symfony\Component\Serializer\SerializerInterface;
  107. *
  108. * @author Jordi Boggiano <j.boggiano@seld.be>
  109. */
  110. -class JsonEncoder extends AbstractEncoder
  111. +class JsonEncoder extends AbstractEncoder implements DecoderInterface
  112. {
  113. /**
  114. * {@inheritdoc}
  115. diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
  116. index 2e0c0af..c465f1b 100644
  117. --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
  118. +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
  119. @@ -20,7 +20,7 @@ use Symfony\Component\Serializer\SerializerInterface;
  120. * @author John Wards <jwards@whiteoctober.co.uk>
  121. * @author Fabian Vogler <fabian@equivalence.ch>
  122. */
  123. -class XmlEncoder extends AbstractEncoder
  124. +class XmlEncoder extends AbstractEncoder implements DecoderInterface
  125. {
  126. private $dom;
  127. private $format;
  128. diff --git a/src/Symfony/Component/Serializer/SerializerAwareInterface.php b/src/Symfony/Component/Serializer/SerializerAwareInterface.php
  129. new file mode 100644
  130. index 0000000..625601e
  131. --- /dev/null
  132. +++ b/src/Symfony/Component/Serializer/SerializerAwareInterface.php
  133. @@ -0,0 +1,38 @@
  134. +<?php
  135. +
  136. +namespace Symfony\Component\Serializer;
  137. +
  138. +use Symfony\Component\Serializer\SerializerInterface;
  139. +
  140. +/*
  141. + * This file is part of the Symfony framework.
  142. + *
  143. + * (c) Fabien Potencier <fabien@symfony.com>
  144. + *
  145. + * This source file is subject to the MIT license that is bundled
  146. + * with this source code in the file LICENSE.
  147. + */
  148. +
  149. +/**
  150. + * Defines the interface of encoders
  151. + *
  152. + * @author Jordi Boggiano <j.boggiano@seld.be>
  153. + */
  154. +interface SerializerAwareInterface
  155. +{
  156. + /**
  157. + * Sets the owning Serializer object
  158. + *
  159. + * @param SerializerInterface $serializer
  160. + * @api
  161. + */
  162. + function setSerializer(SerializerInterface $serializer);
  163. +
  164. + /**
  165. + * Gets the owning Serializer object
  166. + *
  167. + * @return SerializerInterface
  168. + * @api
  169. + */
  170. + function getSerializer();
  171. +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement