You are here

public function CdnBase::query in Libraries CDN API 8

Request wrapper for querying a CDN.

Parameters

string $url: The URL.

Overrides CdnBaseInterface::query

5 calls to CdnBase::query()
CdnBase::getFiles in src/CdnBase.php
Return all available file(s).
CdnBase::getInformation in src/CdnBase.php
Get library information.
CdnBase::getVersions in src/CdnBase.php
Return all available version(s).
CdnBase::isAvailable in src/CdnBase.php
Check if library is available.
CdnBase::search in src/CdnBase.php
Perform a search for a library.

File

src/CdnBase.php, line 116
Class CdnBase.

Class

CdnBase
Class CdnBase.

Namespace

Drupal\libraries_cdn

Code

public function query($url) {
  list($scheme, $url) = explode('://', $url, 2);
  $request = $this
    ->request(sprintf('%s://' . $url, $this
    ->getScheme($scheme), $this
    ->getLibrary()));
  if ($request
    ->getStatusCode() != 200) {
    return array();
  }
  return json_decode($request
    ->getBody()
    ->getContents(), TRUE);
}