d55f3c23891f4f5cb6922889bb5511ef21d4abba
[yaffs-website] / web / modules / contrib / libraries / src / ExternalLibrary / Remote / RemoteLibraryTrait.php
1 <?php
2
3 namespace Drupal\libraries\ExternalLibrary\Remote;
4
5 /**
6  * Provides a trait for remote libraries.
7  */
8 trait RemoteLibraryTrait {
9
10   /**
11    * The remote library URL.
12    *
13    * @var string
14    */
15   protected $remoteUrl;
16
17   /**
18    * Checks whether the library has a remote URL.
19    *
20    * This check allows using the same library class for multiple libraries only
21    * some of which are available remotely.
22    *
23    * @return bool
24    *   TRUE if the library has a remote URL; FALSE otherwise.
25    *
26    * @see \Drupal\libraries\ExternalLibrary\Remote\RemoteLibraryInterface::hasRemoteUrl()
27    */
28   public function hasRemoteUrl() {
29     return !empty($this->remoteUrl);
30   }
31
32   /**
33    * Returns the remote URL of the library.
34    *
35    * @return string
36    *   The remote URL of the library.
37    *
38    * \Drupal\libraries\ExternalLibrary\Remote\RemoteLibraryInterface::getRemoteUrl()
39    */
40   public function getRemoteUrl() {
41     return $this->remoteUrl;
42   }
43
44 }