You are here

public static function ZoneMock::assertValidCredentials in CloudFlare 8

Asserts that credentials are valid. Does NOT pull settings from CMI.

Parameters

string $apikey: The secret Api key used to authenticate against CloudFlare.

string $email: Email of the account used to authenticate against CloudFlare.

\Drupal\cloudflare\CloudFlareComposerDependenciesCheckInterface $composer_dependency_check: Checks that composer dependencies are met.

\Drupal\cloudflare\CloudFlareStateInterface $state: Tracks rate limits associated with CloudFlare Api.

Throws

CloudFlarePhpSdk\Exceptions\CloudFlareInvalidCredentialException Thrown if $apikey and $email fail to authenticate against the Api.

CloudFlarePhpSdk\Exceptions\CloudFlareTimeoutException Thrown if the connection to the Api times out.

CloudFlarePhpSdk\Exceptions\CloudFlareException Thrown if an unknown exception occurs when connecting to the Api.

Overrides CloudFlareZoneInterface::assertValidCredentials

File

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

Class

ZoneMock
Zone methods for CloudFlare.

Namespace

Drupal\cloudflare_form_tester\Mocks

Code

public static function assertValidCredentials($apikey, $email, CloudFlareComposerDependenciesCheckInterface $composer_dependency_check, CloudFlareStateInterface $state) {
  $assert_valid_credentials = \Drupal::state()
    ->get('cloudflaretesting.assetValidCredentials');
  if ($assert_valid_credentials != TRUE) {
    throw new CloudFlareInvalidCredentialException("invalid", 1);
  }
}