You are here

public static function Zone::create in CloudFlare 8

1 string reference to 'Zone::create'
cloudflare.services.yml in ./cloudflare.services.yml
cloudflare.services.yml

File

src/Zone.php, line 80

Class

Zone
Zone methods for CloudFlare.

Namespace

Drupal\cloudflare

Code

public static function create(ConfigFactoryInterface $config_factory, LoggerInterface $logger, CacheBackendInterface $cache, CloudFlareStateInterface $state, CloudFlareComposerDependenciesCheckInterface $check_interface) {
  $config = $config_factory
    ->get('cloudflare.settings');
  $api_key = $config
    ->get('apikey');
  $email = $config
    ->get('email');

  // If someone has not correctly installed composer here is where we need to
  // handle it to prevent PHP error.
  try {
    $check_interface
      ->assert();
    $zoneapi = new ZoneApi($api_key, $email);
  } catch (ComposerDependencyException $e) {
    $zoneapi = NULL;
  }
  return new static($config_factory, $logger, $cache, $state, $zoneapi, $check_interface);
}