LibraryDependencyResolverInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Drupal\Core\Asset;
  3. /**
  4. * Resolves the dependencies of asset (CSS/JavaScript) libraries.
  5. */
  6. interface LibraryDependencyResolverInterface {
  7. /**
  8. * Gets the given libraries with their dependencies.
  9. *
  10. * Given ['core/a', 'core/b', 'core/c'], with core/a depending on core/c and
  11. * core/b on core/d, returns ['core/a', 'core/b', 'core/c', 'core/d'].
  12. *
  13. * @param string[] $libraries
  14. * A list of libraries, in the order they should be loaded.
  15. *
  16. * @return string[]
  17. * A list of libraries, in the order they should be loaded, including their
  18. * dependencies.
  19. */
  20. public function getLibrariesWithDependencies(array $libraries);
  21. /**
  22. * Gets the minimal representative subset of the given libraries.
  23. *
  24. * A minimal representative subset means that any library in the given set of
  25. * libraries that is a dependency of another library in the set, is removed.
  26. *
  27. * Hence a minimal representative subset is the most compact representation
  28. * possible of a set of libraries.
  29. *
  30. * (Each asset library has dependencies and can therefore be seen as a tree.
  31. * Hence the given list of libraries represent a forest. This function returns
  32. * all roots of trees that are not a subtree of another tree in the forest.)
  33. *
  34. * @param string[] $libraries
  35. * A set of libraries.
  36. *
  37. * @return string[]
  38. * A representative subset of the given set of libraries.
  39. */
  40. public function getMinimalRepresentativeSubset(array $libraries);
  41. }