public function VclHandler::checkIfVclExists in Fastly 8.3
Checks if VCL exists.
@name string
Return value
bool TRUE if VCL exists, FALSE otherwise.
3 calls to VclHandler::checkIfVclExists()
- VclHandler::prepareSingleVcl in src/
VclHandler.php - Prepares request for Single VCL.
- VclHandler::prepareVcl in src/
VclHandler.php - Prepares VCL request.
- VclHandler::setImageOptimization in src/
VclHandler.php - Set image optimization.
File
- src/
VclHandler.php, line 642
Class
- VclHandler
- Class to control the VCL handling.
Namespace
Drupal\fastlyCode
public function checkIfVclExists($name) {
if (empty($this->lastVersionData)) {
return FALSE;
}
$url = $this->versionBaseUrl . '/' . $this->lastClonedVersion . '/snippet/' . $name;
$response = $this
->vclGetWrapper($url);
$responseBody = (string) $response
->getBody();
if (empty($responseBody)) {
return FALSE;
}
$_responseBody = json_decode($response
->getBody());
if (!empty($_responseBody->content)) {
return TRUE;
}
return FALSE;
}