class ComposerDependenciesCheck in CloudFlare 8
Same name in this branch
- 8 src/ComposerDependenciesCheck.php \Drupal\cloudflare\ComposerDependenciesCheck
- 8 modules/cloudflarepurger/src/Plugin/Purge/DiagnosticCheck/ComposerDependenciesCheck.php \Drupal\cloudflarepurger\Plugin\Purge\DiagnosticCheck\ComposerDependenciesCheck
Tests that composer dependencies are met.
Hierarchy
- class \Drupal\cloudflare\ComposerDependenciesCheck implements CloudFlareComposerDependenciesCheckInterface
Expanded class hierarchy of ComposerDependenciesCheck
1 string reference to 'ComposerDependenciesCheck'
1 service uses ComposerDependenciesCheck
File
- src/
ComposerDependenciesCheck.php, line 11
Namespace
Drupal\cloudflareView source
class ComposerDependenciesCheck implements CloudFlareComposerDependenciesCheckInterface {
/**
* Set the first time that this function is called in a bootstrap.
*
* @var bool
*/
public static $areDependenciesMet = NULL;
/**
* A logger instance.
*
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* {@inheritdoc}
*/
public static function create(LoggerInterface $logger) {
return new static($logger);
}
/**
* ComposerDependenciesCheck constructor.
*
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
*/
public function __construct(LoggerInterface $logger) {
$this->logger = $logger;
}
/**
* {@inheritdoc}
*/
public function check() {
// This check will help prevent multiple redundant criticals from being
// logged.
if (!is_null(self::$areDependenciesMet)) {
return self::$areDependenciesMet;
}
if (class_exists('\\CloudFlarePhpSdk\\ApiEndpoints\\ZoneApi')) {
self::$areDependenciesMet = TRUE;
}
else {
self::$areDependenciesMet = FALSE;
$this->logger
->critical(self::ERROR_MESSAGE);
}
return self::$areDependenciesMet;
}
/**
* {@inheritdoc}
*/
public function assert() {
if (!$this
->check()) {
throw new ComposerDependencyException(self::ERROR_MESSAGE);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CloudFlareComposerDependenciesCheckInterface:: |
constant | |||
ComposerDependenciesCheck:: |
public static | property | Set the first time that this function is called in a bootstrap. | |
ComposerDependenciesCheck:: |
protected | property | A logger instance. | |
ComposerDependenciesCheck:: |
public | function |
Asserts that composer dependencies for CloudFlare are met. Overrides CloudFlareComposerDependenciesCheckInterface:: |
|
ComposerDependenciesCheck:: |
public | function |
Tests that composer dependencies for CloudFlare are met. Overrides CloudFlareComposerDependenciesCheckInterface:: |
|
ComposerDependenciesCheck:: |
public static | function | ||
ComposerDependenciesCheck:: |
public | function | ComposerDependenciesCheck constructor. |