You are here

public function SiteAuditCheckExtensionsCount::calculateScore in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Extensions/Count.php \SiteAuditCheckExtensionsCount::calculateScore()

Implements \SiteAudit\Check\Abstract\calculateScore().

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/Extensions/Count.php, line 90
Contains \SiteAudit\Check\Extensions\Count.

Class

SiteAuditCheckExtensionsCount
Class SiteAuditCheckExtensionsCount.

Code

public function calculateScore() {
  $this->registry['extension_count'] = 0;
  $this->registry['extensions'] = drush_get_extensions(FALSE);
  foreach ($this->registry['extensions'] as $extension) {
    $status = drush_get_extension_status($extension);
    if (!in_array($status, array(
      'enabled',
    ))) {
      continue;
    }
    $this->registry['extension_count']++;
  }
  if ($this->registry['extension_count'] >= drush_get_option('extension_count', 150)) {
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
  }
  return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}