Groups.php 637 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\CardDAV\Xml;
  8. use Sabre\Xml\Writer;
  9. use Sabre\Xml\XmlSerializable;
  10. class Groups implements XmlSerializable {
  11. public const NS_OWNCLOUD = 'http://owncloud.org/ns';
  12. /**
  13. * @param list<string> $groups
  14. */
  15. public function __construct(
  16. private array $groups,
  17. ) {
  18. }
  19. public function xmlSerialize(Writer $writer) {
  20. foreach ($this->groups as $group) {
  21. $writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group);
  22. }
  23. }
  24. }