1
0

IValidator.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\RichObjectStrings;
  8. /**
  9. * Class Validator
  10. *
  11. * @psalm-type RichObjectParameter = array{
  12. * type: string,
  13. * id: string,
  14. * name: string,
  15. * server?: string,
  16. * link?: string,
  17. * 'call-type'?: 'one2one'|'group'|'public',
  18. * 'icon-url'?: string,
  19. * 'message-id'?: string,
  20. * boardname?: string,
  21. * stackname?: string,
  22. * size?: string,
  23. * path?: string,
  24. * mimetype?: string,
  25. * 'preview-available'?: 'yes'|'no',
  26. * mtime?: string,
  27. * latitude?: string,
  28. * longitude?: string,
  29. * description?: string,
  30. * thumb?: string,
  31. * website?: string,
  32. * visibility?: '0'|'1',
  33. * assignable?: '0'|'1',
  34. * conversation?: string,
  35. * etag?: string,
  36. * permissions?: string,
  37. * width?: string,
  38. * height?: string,
  39. * blurhash?: string,
  40. * }
  41. *
  42. * @since 11.0.0
  43. */
  44. interface IValidator {
  45. /**
  46. * Only alphanumeric, dash, underscore and dot are allowed, starting with a character
  47. * @since 31.0.0
  48. */
  49. public const PLACEHOLDER_REGEX = '[A-Za-z][A-Za-z0-9\-_.]+';
  50. /**
  51. * @param string $subject
  52. * @param array<non-empty-string, RichObjectParameter> $parameters
  53. * @throws InvalidObjectExeption
  54. * @since 11.0.0
  55. */
  56. public function validate(string $subject, array $parameters): void;
  57. }