You are here

public function SiteAuditCheckAbstract::getCustomCodePaths in Site Audit 8.2

Returns an array containing custom code paths or AUDIT_CHECK_SCORE_INFO.

Return value

array|bool An array containing custom code paths or an empty array if custom code paths are not found. If any of the custom code paths is invalid, it returns FALSE.

5 calls to SiteAuditCheckAbstract::getCustomCodePaths()
SiteAuditCheckCodebasePhpCodeSniffer::calculateScore in Check/Codebase/PhpCodeSniffer.php
Implements \SiteAudit\Check\Abstract\calculateScore().
SiteAuditCheckCodebasePhpCopyPasteDetection::calculateScore in Check/Codebase/PhpCopyPasteDetection.php
Implements \SiteAudit\Check\Abstract\calculateScore().
SiteAuditCheckCodebasePhpDeadCodeDetection::calculateScore in Check/Codebase/PhpDeadCodeDetection.php
Implements \SiteAudit\Check\Abstract\calculateScore().
SiteAuditCheckCodebasePhpLOC::calculateScore in Check/Codebase/PhpLOC.php
Implements \SiteAudit\Check\Abstract\calculateScore().
SiteAuditCheckCodebasePhpMessDetection::calculateScore in Check/Codebase/PhpMessDetection.php
Implements \SiteAudit\Check\Abstract\calculateScore().

File

Check/Abstract.php, line 324
Contains \SiteAudit\Check\Abstract.

Class

SiteAuditCheckAbstract
Class SiteAuditCheckAbstract.

Code

public function getCustomCodePaths() {
  if (SiteAuditCheckAbstract::$customCode === NULL) {
    $custom_code = \Drupal::config('site_audit')
      ->get('custom-code');
    if ($custom_code == NULL) {
      $custom_code = drush_get_option('custom-code', '');
      if (empty($custom_code)) {
        $custom_code = array();
      }
      else {
        $custom_code = explode(',', $custom_code);
      }
    }
    foreach ($custom_code as $path) {
      if (!is_dir($path) && !is_file($path)) {
        drush_log(dt('"@path" given in custom-code option is not a valid file or directory.', array(
          '@path' => $path,
        )));
        return FALSE;
      }
    }
    SiteAuditCheckAbstract::$customCode = $custom_code;
  }
  return SiteAuditCheckAbstract::$customCode;
}