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