You are here

class State in Fastly 8.3

Tracks validity of credentials associated with Fastly Api.

Hierarchy

  • class \Drupal\fastly\State

Expanded class hierarchy of State

3 files declare their use of State
CredentialCheck.php in modules/fastlypurger/src/Plugin/Purge/DiagnosticCheck/CredentialCheck.php
FastlySettingsForm.php in src/Form/FastlySettingsForm.php
PurgeOptionsForm.php in src/Form/PurgeOptionsForm.php
1 string reference to 'State'
fastly.services.yml in ./fastly.services.yml
fastly.services.yml
1 service uses State
fastly.state in ./fastly.services.yml
Drupal\fastly\State

File

src/State.php, line 10

Namespace

Drupal\fastly
View source
class State {
  const VALID_PURGE_CREDENTIALS = 'fastly.state.valid_purge_credentials';

  /**
   * The drupal state service.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  protected $state;

  /**
   * ValidateCredentials constructor.
   *
   * @param \Drupal\Core\State\StateInterface $state
   *   The drupal state service.
   */
  public function __construct(StateInterface $state) {
    $this->state = $state;
  }

  /**
   * Get the state of the Fastly credentials related to Purge functionality.
   *
   * Get the Drupal state representing whether or not the configured Fastly Api
   * credentials are sufficient to perform all supported purge operations.
   *
   * @return mixed
   *   The state of the configured Fastly Api credentials
   */
  public function getPurgeCredentialsState() {
    $state = $this->state
      ->get(self::VALID_PURGE_CREDENTIALS);
    return $state;
  }

  /**
   * Set the state of the Fastly credentials related to Purge functionality.
   *
   * Set the Drupal state representing whether or not the configured Fastly Api
   * credentials are sufficient to perform all supported purge operations.
   */
  public function setPurgeCredentialsState($state = FALSE) {
    $this->state
      ->set(self::VALID_PURGE_CREDENTIALS, $state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
State::$state protected property The drupal state service.
State::getPurgeCredentialsState public function Get the state of the Fastly credentials related to Purge functionality.
State::setPurgeCredentialsState public function Set the state of the Fastly credentials related to Purge functionality.
State::VALID_PURGE_CREDENTIALS constant
State::__construct public function ValidateCredentials constructor.