You are here

public function CdnBase::isAvailable in Libraries CDN API 8

Check if library is available.

Return value

bool Return TRUE if the library is available, otherwise, FALSE.

Overrides CdnBaseInterface::isAvailable

3 calls to CdnBase::isAvailable()
CdnBase::getFiles in src/CdnBase.php
Return all available file(s).
CdnBase::getVersions in src/CdnBase.php
Return all available version(s).
CdnBase::search in src/CdnBase.php
Perform a search for a library.

File

src/CdnBase.php, line 152
Class CdnBase.

Class

CdnBase
Class CdnBase.

Namespace

Drupal\libraries_cdn

Code

public function isAvailable() {
  if (isset($this->configuration['available'])) {
    return (bool) $this->configuration['available'];
  }
  $data = $this
    ->query($this
    ->getURL(__FUNCTION__));
  if (count($this
    ->formatData(__FUNCTION__, $data)) !== 0) {
    $this->configuration['available'] = TRUE;
    return TRUE;
  }
  else {
    $this->configuration['available'] = FALSE;
    return FALSE;
  }
}