You are here

public function ZoneMock::listZones in CloudFlare 8

Retrieves a listing of zones in the current CloudFlare account.

Return value

array A array of CloudFlareZones objects from the current CloudFlare account.

Throws

\CloudFlarePhpSdk\Exceptions\CloudFlareApiException Application level error returned from the API.

Overrides CloudFlareZoneInterface::listZones

File

tests/modules/cloudflare_form_tester/src/Mocks/ZoneMock.php, line 149

Class

ZoneMock
Zone methods for CloudFlare.

Namespace

Drupal\cloudflare_form_tester\Mocks

Code

public function listZones() {
  $cloudflare_zone_settings = [];
  $cloudflare_zone_settings['id'] = '123456789';
  $cloudflare_zone_settings['name'] = 'testdomain.com';
  $cloudflare_zone_settings['status'] = 'Active';
  $cloudflare_zone_settings['paused'] = FALSE;
  $cloudflare_zone_settings['type'] = 'zone';
  $cloudflare_zone_settings['development_mode'] = FALSE;
  $cloudflare_zone_settings['name_servers'] = [
    '1.2.3.4',
    '1.2.3.5',
  ];
  $cloudflare_zone_settings['original_name_servers'] = [
    '1.2.3.4',
    '1.2.3.5',
  ];
  $cloudflare_zone_settings['original_registrar'] = 'rsa.com';
  $cloudflare_zone_settings['original_dnshost'] = [
    '1.2.3.4',
    '1.2.3.5',
  ];
  $cloudflare_zone_settings['modified_on'] = '1453579581 ';
  $cloudflare_zone_settings['created_on'] = '1453579581';
  $cloudflare_zone_settings['owner'] = 'Drupal Developer';
  $cloudflare_zone_settings['permissions'] = 'EMPTY';
  $cloudflare_zone_settings['plan'] = 'EMPTY';
  $cloudflare_zone_settings2['id'] = '123456789999';
  $cloudflare_zone_settings2['name'] = 'testdomain2.com';
  $cloudflare_zone_settings2['status'] = 'Active';
  $cloudflare_zone_settings2['paused'] = FALSE;
  $cloudflare_zone_settings2['type'] = 'zone';
  $cloudflare_zone_settings2['development_mode'] = FALSE;
  $cloudflare_zone_settings2['name_servers'] = [
    '1.2.3.4',
    '1.2.3.5',
  ];
  $cloudflare_zone_settings2['original_name_servers'] = [
    '1.2.3.4',
    '1.2.3.5',
  ];
  $cloudflare_zone_settings2['original_registrar'] = 'rsa.com';
  $cloudflare_zone_settings2['original_dnshost'] = [
    '1.2.3.4',
    '1.2.3.5',
  ];
  $cloudflare_zone_settings2['modified_on'] = '1453579581 ';
  $cloudflare_zone_settings2['created_on'] = '1453579581';
  $cloudflare_zone_settings2['owner'] = 'Drupal Developer';
  $cloudflare_zone_settings2['permissions'] = 'EMPTY';
  $cloudflare_zone_settings2['plan'] = 'EMPTY';
  $zone1 = new Zone($cloudflare_zone_settings);
  $zone2 = new Zone($cloudflare_zone_settings2);
  $has_multi_zone = \Drupal::state()
    ->get('cloudflaretesting.multizone');
  if ($has_multi_zone) {
    return [
      $zone1,
      $zone2,
    ];
  }
  else {
    return [
      $zone1,
    ];
  }
}