You are here

protected function InstallableLibrary::requestJson in Markdown 8.2

Retrieves JSON from a URL.

Parameters

string $url: The URL where to retrieve JSON from.

Return value

array|void An array of JSON if successful, NULL otherwise.

2 calls to InstallableLibrary::requestJson()
ComposerPackage::getAvailableVersions in src/Annotation/ComposerPackage.php
Retrieves the available versions of the library.
ComposerPackage::requestPackage in src/Annotation/ComposerPackage.php
Retrieves the package JSON data.

File

src/Annotation/InstallableLibrary.php, line 515

Class

InstallableLibrary

Namespace

Drupal\markdown\Annotation

Code

protected function requestJson($url) {
  $response = $this
    ->request($url);
  $statusCode = $response
    ->getStatusCode();
  if ($statusCode >= 200 && $statusCode < 400 && ($contents = $response
    ->getContent()) && ($json = Json::decode($contents))) {
    return $json;
  }
}