XmlSerializable.php 1003 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sabre\Xml;
  4. /**
  5. * Objects implementing XmlSerializable can control how they are represented in
  6. * Xml.
  7. *
  8. * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
  9. * @author Evert Pot (http://evertpot.com/)
  10. * @license http://sabre.io/license/ Modified BSD License
  11. */
  12. interface XmlSerializable
  13. {
  14. /**
  15. * The xmlSerialize method is called during xml writing.
  16. *
  17. * Use the $writer argument to write its own xml serialization.
  18. *
  19. * An important note: do _not_ create a parent element. Any element
  20. * implementing XmlSerializable should only ever write what's considered
  21. * its 'inner xml'.
  22. *
  23. * The parent of the current element is responsible for writing a
  24. * containing element.
  25. *
  26. * This allows serializers to be re-used for different element names.
  27. *
  28. * If you are opening new elements, you must also close them again.
  29. */
  30. public function xmlSerialize(Writer $writer);
  31. }