You are here

public function Vcl::prepare_response_object in Fastly 7.2

Prepares request object for insertion.

Return value

array|bool

1 call to Vcl::prepare_response_object()
Vcl::execute in ./fastly.vcl.inc
Main execute function, takes values inserted into constructor, builds requests and sends them via Fastly API.

File

./fastly.vcl.inc, line 564

Class

Vcl
Class to control the VCL handling.

Code

public function prepare_response_object() {

  // Prepare setting content.
  $requests = array();
  foreach ($this->_response_object_data as $single_response_object_data) {
    if (empty($single_response_object_data['name']) || empty($single_response_object_data['request_condition']) || empty($single_response_object_data['content'])) {
      $this
        ->add_error(t('Setting data not properly set.'));
      return FALSE;
    }
    else {
      if ($this
        ->get_response_object($single_response_object_data['name'])) {
        $requests[] = $this
          ->prepare_update_response_object($single_response_object_data);
      }
      else {
        $requests[] = $this
          ->prepare_insert_response_object($single_response_object_data);
      }
    }
  }
  return $requests;
}