61fc589ccab3fabec86faf97a7b3db0caab25bdc
[yaffs-website] / web / modules / contrib / libraries / src / ExternalLibrary / Definition / DefinitionDiscoveryInterface.php
1 <?php
2
3 namespace Drupal\libraries\ExternalLibrary\Definition;
4
5 /**
6  * Provides an interface for library definition discoveries.
7  *
8  * This is similar to the plugin system's DiscoveryInterface, except that this
9  * does not require knowing all definitions upfront, so there is no
10  * getDefinitions() method.
11  *
12  * @see \Drupal\Component\Plugin\Discovery\DiscoveryInterface
13  *
14  * @ingroup libraries
15  */
16 interface DefinitionDiscoveryInterface {
17
18   /**
19    * Checks whether a library definition exists.
20    *
21    * @param string $id
22    *   The library ID.
23    *
24    * @return bool
25    *   TRUE if a library definition with the given ID exists; FALSE otherwise.
26    */
27   public function hasDefinition($id);
28
29   /**
30    * Gets a library definition by its ID.
31    *
32    * @param string $id
33    *   The library ID.
34    *
35    * @return array
36    *   The library definition.
37    *
38    * @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException
39    *
40    * @todo Consider returning a classed object instead of an array or at least
41    *   document and validate the array structure.
42    */
43   public function getDefinition($id);
44
45 }