You are here

Fast404.php in Site Audit 8.2

Same filename and directory in other branches
  1. 7 Check/BestPractices/Fast404.php

Contains \SiteAudit\Check\BestPractices\Fast404.

File

Check/BestPractices/Fast404.php
View source
<?php

/**
 * @file
 * Contains \SiteAudit\Check\BestPractices\Fast404.
 */

/**
 * Class SiteAuditCheckBestPracticesFast404.
 */
class SiteAuditCheckBestPracticesFast404 extends SiteAuditCheckAbstract {

  /**
   * Implements \SiteAudit\Check\Abstract\getLabel().
   */
  public function getLabel() {
    return dt('Fast 404 pages');
  }

  /**
   * Implements \SiteAudit\Check\Abstract\getDescription().
   */
  public function getDescription() {
    return dt('Check if enabled.');
  }

  /**
   * Implements \SiteAudit\Check\Abstract\getResultFail().
   */
  public function getResultFail() {
  }

  /**
   * Implements \SiteAudit\Check\Abstract\getResultInfo().
   */
  public function getResultInfo() {
  }

  /**
   * Implements \SiteAudit\Check\Abstract\getResultPass().
   */
  public function getResultPass() {
    return dt('Fast 404 pages are enabled.');
  }

  /**
   * Implements \SiteAudit\Check\Abstract\getResultWarn().
   */
  public function getResultWarn() {
    return dt('Fast 404 pages are not enabled for any path.');
  }

  /**
   * Implements \SiteAudit\Check\Abstract\getAction().
   */
  public function getAction() {
    if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN) {
      return dt('See https://github.com/drupal/drupal/blob/8.0.x/sites/default/default.settings.php#L572 for details on how to implement.');
    }
  }

  /**
   * Implements \SiteAudit\Check\Abstract\calculateScore().
   */
  public function calculateScore() {
    $config = \Drupal::config('system.performance');
    if ($config
      ->get('fast_404.enabled') && trim($config
      ->get('fast_404.paths')) != '') {
      return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
    }
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
  }

}

Classes

Namesort descending Description
SiteAuditCheckBestPracticesFast404 Class SiteAuditCheckBestPracticesFast404.