DomainLoaderInterface.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace Drupal\domain;
  3. /**
  4. * Supplies loader methods for common domain requests.
  5. *
  6. * @deprecated
  7. * This interface will be removed before the 8.1.0 release.
  8. */
  9. interface DomainLoaderInterface {
  10. /**
  11. * Loads a single domains.
  12. *
  13. * @param int $id
  14. * A domain id to load.
  15. * @param bool $reset
  16. * Indicates that the entity cache should be reset.
  17. *
  18. * @return \Drupal\domain\DomainInterface|null
  19. * A domain record or NULL.
  20. */
  21. public function load($id, $reset = FALSE);
  22. /**
  23. * Gets the default domain object.
  24. *
  25. * @return \Drupal\domain\DomainInterface|null
  26. * The default domain record or NULL.
  27. */
  28. public function loadDefaultDomain();
  29. /**
  30. * Returns the id of the default domain.
  31. *
  32. * @return int
  33. * The id of the default domain or FALSE if none is set.
  34. */
  35. public function loadDefaultId();
  36. /**
  37. * Loads multiple domains.
  38. *
  39. * @param array $ids
  40. * An optional array of specific ids to load.
  41. * @param bool $reset
  42. * Indicates that the entity cache should be reset.
  43. *
  44. * @return \Drupal\domain\DomainInterface[]
  45. * An array of domain records.
  46. */
  47. public function loadMultiple(array $ids = NULL, $reset = FALSE);
  48. /**
  49. * Loads multiple domains and sorts by weight.
  50. *
  51. * @param array $ids
  52. * An optional array of specific ids to load.
  53. *
  54. * @return \Drupal\domain\DomainInterface[]
  55. * An array of domain records.
  56. */
  57. public function loadMultipleSorted(array $ids = NULL);
  58. /**
  59. * Loads a domain record by hostname lookup.
  60. *
  61. * @param string $hostname
  62. * A hostname string, in the format example.com.
  63. *
  64. * @return \Drupal\domain\DomainInterface|null
  65. * The domain record or NULL.
  66. */
  67. public function loadByHostname($hostname);
  68. /**
  69. * Returns the list of domains formatted for a form options list.
  70. *
  71. * @return array
  72. * A weight-sorted array of id => label for use in forms.
  73. */
  74. public function loadOptionsList();
  75. /**
  76. * Sorts domains by weight.
  77. *
  78. * For use by loadMultipleSorted().
  79. *
  80. * @param DomainInterface $a
  81. * The first Domain object to sort.
  82. * @param DomainInterface $b
  83. * The Domain object to compare against.
  84. *
  85. * @return bool
  86. * Wether the first domain weight is greater or not.
  87. */
  88. public function sort(DomainInterface $a, DomainInterface $b);
  89. /**
  90. * Gets the entity field schema for domain records.
  91. *
  92. * @return array
  93. * An array representing the field schema of the object.
  94. */
  95. public function loadSchema();
  96. /**
  97. * Removes www. prefix from a hostname, if set.
  98. *
  99. * @param string $hostname
  100. * A hostname.
  101. *
  102. * @return string
  103. * The cleaned hostname.
  104. */
  105. public function prepareHostname($hostname);
  106. }