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