Further modules included.
[yaffs-website] / web / modules / contrib / libraries / src / ExternalLibrary / Version / VersionedLibraryInterface.php
1 <?php
2
3 namespace Drupal\libraries\ExternalLibrary\Version;
4
5 use Drupal\Component\Plugin\Factory\FactoryInterface;
6 use Drupal\libraries\ExternalLibrary\LibraryInterface;
7
8 /**
9  * Provides an interface for versioned libraries.
10  *
11  * Version detection and negotiation is a key aspect of Libraries API's
12  * functionality so most libraries should implement this interface. In theory,
13  * however, it might be possible for the same library to be available in
14  * multiple versions and, for example, different versions being loaded on
15  * different pages. In this case, a simple getVersion() method, does not make
16  * sense. To support such advanced version detection behavior in the future or
17  * in a separate module, version detection is split into a separate interface.
18  *
19  * @ingroup libraries
20  *
21  * @todo Support versioned metadata, i.e. different library file names or
22  *   locations for different library versions.
23  */
24 interface VersionedLibraryInterface extends LibraryInterface {
25
26   /**
27    * Gets the version of the library.
28    *
29    * @return string
30    *   The version string, for example 1.0, 2.1.4, or 3.0.0-alpha5.
31    *
32    * @throws \Drupal\libraries\ExternalLibrary\Exception\UnknownLibraryVersionException
33    *
34    * @see \Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface::setVersion()
35    */
36   public function getVersion();
37
38   /**
39    * Sets the version of the library.
40    *
41    * @param string $version
42    *   The version of the library.
43    *
44    * @reutrn $this
45    *
46    * @see \Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface::getVersion()
47    */
48   public function setVersion($version);
49
50   /**
51    * Gets the version detector of this library using the detector factory.
52    *
53    * Because determining the installation version of a library is not specific
54    * to any library or even any library type, this logic is offloaded to
55    * separate detector objects.
56    *
57    * @param \Drupal\Component\Plugin\Factory\FactoryInterface $detector_factory
58    *
59    * @return \Drupal\libraries\ExternalLibrary\Version\VersionDetectorInterface
60    *
61    * @see \Drupal\libraries\ExternalLibrary\Version\VersionDetectorInterface
62    */
63   public function getVersionDetector(FactoryInterface $detector_factory);
64
65 }