public function VclHandler::prepareCondition in Fastly 8.3
Prepares condition for insertion.
Return value
array|bool Request data to insert condition or FALSE if condition data invalid.
1 call to VclHandler::prepareCondition()
- VclHandler::execute in src/
VclHandler.php - Main execute function.
File
- src/
VclHandler.php, line 777
Class
- VclHandler
- Class to control the VCL handling.
Namespace
Drupal\fastlyCode
public function prepareCondition() {
// Prepare condition content.
$requests = [];
foreach ($this->conditionData as $single_condition_data) {
if (empty($single_condition_data['name']) || empty($single_condition_data['statement']) || empty($single_condition_data['type']) || empty($single_condition_data['priority'])) {
$message = $this
->t('Condition data not properly set.');
$this
->addError($message);
$this->logger
->critical($message);
return FALSE;
}
else {
if ($this
->checkCondition($single_condition_data['name'])) {
$requests[] = $this
->prepareUpdateCondition($single_condition_data);
}
else {
// Do insert here because condition is needed before setting
// (requests are not sent in order).
return $this
->insertCondition($single_condition_data);
}
}
}
return $requests;
}