You are here

trait BrowserCookieTrait in Bakery Single Sign-On System 8.2

Hierarchy

1 file declares its use of BrowserCookieTrait
BrowserCookieTraitTest.php in tests/src/Unit/Cookies/BrowserCookieTraitTest.php

File

src/Cookies/BrowserCookieTrait.php, line 8

Namespace

Drupal\bakery\Cookies
View source
trait BrowserCookieTrait {

  /**
   * Helper to determine if the current site is the "main" site.
   */
  protected function getIsMain() : bool {
    return static::getBakeryService()
      ->isMain();
  }

  /**
   * Wrap cookie name for browser.
   */
  protected static function cookieName(string $type) : string {
    return static::getBakeryKitchen()
      ->cookieName($type);
  }

  /**
   * Get a bakery service.
   */
  private static function getBakeryService() : BakeryService {
    return \Drupal::service('bakery.bakery_service');
  }

  /**
   * Get a kitchen.
   */
  private static function getBakeryKitchen() : Kitchen {
    return \Drupal::service('bakery.kitchen');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BrowserCookieTrait::cookieName protected static function Wrap cookie name for browser.
BrowserCookieTrait::getBakeryKitchen private static function Get a kitchen.
BrowserCookieTrait::getBakeryService private static function Get a bakery service.
BrowserCookieTrait::getIsMain protected function Helper to determine if the current site is the "main" site.