Invite.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sabre\DAV\Xml\Property;
  4. use Sabre\DAV\Xml\Element\Sharee;
  5. use Sabre\Xml\Writer;
  6. use Sabre\Xml\XmlSerializable;
  7. /**
  8. * This class represents the {DAV:}invite property.
  9. *
  10. * This property is defined here:
  11. * https://tools.ietf.org/html/draft-pot-webdav-resource-sharing-03#section-4.4.2
  12. *
  13. * This property is used by clients to determine who currently has access to
  14. * a shared resource, what their access level is and what their invite status
  15. * is.
  16. *
  17. * @copyright Copyright (C) fruux GmbH (https://fruux.com/).
  18. * @author Evert Pot (http://evertpot.com/)
  19. * @license http://sabre.io/license/ Modified BSD License
  20. */
  21. class Invite implements XmlSerializable
  22. {
  23. /**
  24. * A list of sharees.
  25. *
  26. * @var Sharee[]
  27. */
  28. public $sharees = [];
  29. /**
  30. * Creates the property.
  31. *
  32. * @param Sharee[] $sharees
  33. */
  34. public function __construct(array $sharees)
  35. {
  36. $this->sharees = $sharees;
  37. }
  38. /**
  39. * The xmlSerialize method is called during xml writing.
  40. *
  41. * Use the $writer argument to write its own xml serialization.
  42. *
  43. * An important note: do _not_ create a parent element. Any element
  44. * implementing XmlSerializable should only ever write what's considered
  45. * its 'inner xml'.
  46. *
  47. * The parent of the current element is responsible for writing a
  48. * containing element.
  49. *
  50. * This allows serializers to be re-used for different element names.
  51. *
  52. * If you are opening new elements, you must also close them again.
  53. */
  54. public function xmlSerialize(Writer $writer)
  55. {
  56. foreach ($this->sharees as $sharee) {
  57. $writer->writeElement('{DAV:}sharee', $sharee);
  58. }
  59. }
  60. }