class PhpSapi in Automatic Updates 8
Warn if PHP SAPI changes between checker executions.
Hierarchy
- class \Drupal\automatic_updates\ReadinessChecker\PhpSapi implements ReadinessCheckerInterface uses StringTranslationTrait
Expanded class hierarchy of PhpSapi
1 string reference to 'PhpSapi'
1 service uses PhpSapi
File
- src/ReadinessChecker/ PhpSapi.php, line 11 
Namespace
Drupal\automatic_updates\ReadinessCheckerView source
class PhpSapi implements ReadinessCheckerInterface {
  use StringTranslationTrait;
  /**
   * The state service.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  protected $state;
  /**
   * PhpSapi constructor.
   *
   * @param \Drupal\Core\State\StateInterface $state
   *   The state service.
   */
  public function __construct(StateInterface $state) {
    $this->state = $state;
  }
  /**
   * {@inheritdoc}
   */
  public function run() {
    $messages = [];
    $php_sapi = $this->state
      ->get('automatic_updates.php_sapi', PHP_SAPI);
    if ($php_sapi !== PHP_SAPI) {
      $messages[] = $this
        ->t('PHP changed from running as "@previous" to "@current". This can lead to inconsistent and misleading results.', [
        '@previous' => $php_sapi,
        '@current' => PHP_SAPI,
      ]);
    }
    $this->state
      ->set('automatic_updates.php_sapi', PHP_SAPI);
    return $messages;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| PhpSapi:: | protected | property | The state service. | |
| PhpSapi:: | public | function | Run check. Overrides ReadinessCheckerInterface:: | |
| PhpSapi:: | public | function | PhpSapi constructor. | |
| StringTranslationTrait:: | protected | property | The string translation service. | 1 | 
| StringTranslationTrait:: | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait:: | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait:: | protected | function | Gets the string translation service. | |
| StringTranslationTrait:: | public | function | Sets the string translation service to use. | 2 | 
| StringTranslationTrait:: | protected | function | Translates a string to the current language or to a given language. | 
