You are here

public function VclHandler::checkCondition in Fastly 8.3

Checks if condition exists.

Parameters

string $name: Condition name.

Return value

bool FALSE if response not returned or without condition, TRUE otherwise.

1 call to VclHandler::checkCondition()
VclHandler::prepareCondition in src/VclHandler.php
Prepares condition for insertion.

File

src/VclHandler.php, line 815

Class

VclHandler
Class to control the VCL handling.

Namespace

Drupal\fastly

Code

public function checkCondition($name) {
  $url = $this->versionBaseUrl . '/' . $this->lastClonedVersion . '/condition/' . $name;
  $response = $this
    ->vclGetWrapper($url, $this->headersGet);
  $responseBody = (string) $response
    ->getBody();
  $_responseBody = json_decode($responseBody);
  if (empty($_responseBody)) {
    return FALSE;
  }
  if ($_responseBody->version) {
    return TRUE;
  }
  return FALSE;
}