ComposerDependenciesCheck.php in CloudFlare 8        
                          
                  
                        
  
  
  
  
File
  modules/cloudflarepurger/src/Plugin/Purge/DiagnosticCheck/ComposerDependenciesCheck.php
  
    View source  
  <?php
namespace Drupal\cloudflarepurger\Plugin\Purge\DiagnosticCheck;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckBase;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckInterface;
use Drupal\cloudflare\CloudFlareComposerDependenciesCheckInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ComposerDependenciesCheck extends DiagnosticCheckBase implements DiagnosticCheckInterface {
  
  protected $areCloudFlareComposerDependenciesMet;
  
  public function __construct(array $configuration, $plugin_id, $plugin_definition, CloudFlareComposerDependenciesCheckInterface $check_interface) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->areCloudFlareComposerDependenciesMet = $check_interface
      ->check();
  }
  
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('cloudflare.composer_dependency_check'));
  }
  
  public function run() {
    if (!$this->areCloudFlareComposerDependenciesMet) {
      $this->recommendation = CloudFlareComposerDependenciesCheckInterface::ERROR_MESSAGE;
      return SELF::SEVERITY_ERROR;
    }
    else {
      $this->recommendation = $this
        ->t('Composer dependencies have been met.');
      return SELF::SEVERITY_OK;
    }
  }
}