class ChocolateChip in Bakery Single Sign-On System 8.2
Hierarchy
- class \Drupal\bakery\Cookies\ChocolateChip implements CookieInterface uses BrowserCookieTrait
Expanded class hierarchy of ChocolateChip
7 files declare their use of ChocolateChip
- BootSubscriber.php in src/
EventSubscriber/ BootSubscriber.php - For Boot event subscribe.
- ChildLoginTest.php in tests/
src/ Functional/ ChildLoginTest.php - ChildSitePagesTest.php in tests/
src/ Functional/ ChildSitePagesTest.php - ChocolateChipTest.php in tests/
src/ Unit/ Cookies/ ChocolateChipTest.php - Kitchen.php in src/
Kitchen.php
File
- src/
Cookies/ ChocolateChip.php, line 5
Namespace
Drupal\bakery\CookiesView source
class ChocolateChip implements CookieInterface {
use BrowserCookieTrait;
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $mail;
/**
* @var string
*/
protected $init;
/**
* @var bool|null
*/
protected $isMain;
private $calories = 480;
public final function __construct($name, $mail, $init, $is_main = NULL) {
$this->name = $name;
$this->mail = $mail;
$this->init = $init;
$this->isMain = $is_main;
}
/**
* {@inheritDoc}
*/
public static function fromData(array $data) {
return new static($data['name'] ?? '', $data['mail'] ?? '', $data['init'] ?? '');
}
/**
* {@inheritDoc}
*/
public function toData() : array {
return [
'name' => $this->name,
'mail' => $this->mail,
// should this be calculated?
'init' => $this->init,
'master' => $this->isMain ?? $this
->getIsMain(),
'calories' => $this->calories,
];
}
/**
* {@inheritDoc}
*/
public static function getName() : string {
return static::cookieName('CHOCOLATECHIP');
}
public function getAccountName() : string {
return $this->name;
}
public function getEmail() : string {
return $this->mail;
}
public function getInit() : string {
return $this->init;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BrowserCookieTrait:: |
protected static | function | Wrap cookie name for browser. | |
BrowserCookieTrait:: |
private static | function | Get a kitchen. | |
BrowserCookieTrait:: |
private static | function | Get a bakery service. | |
BrowserCookieTrait:: |
protected | function | Helper to determine if the current site is the "main" site. | |
ChocolateChip:: |
private | property | ||
ChocolateChip:: |
protected | property | ||
ChocolateChip:: |
protected | property | ||
ChocolateChip:: |
protected | property | ||
ChocolateChip:: |
protected | property | ||
ChocolateChip:: |
public static | function |
Create from data stored in a cookie. Overrides CookieInterface:: |
|
ChocolateChip:: |
public | function | ||
ChocolateChip:: |
public | function | ||
ChocolateChip:: |
public | function | ||
ChocolateChip:: |
public static | function |
Get the cookie name/type. Overrides CookieInterface:: |
|
ChocolateChip:: |
public | function |
Convert the data into an array to be stored into a cookie. Overrides CookieInterface:: |
|
ChocolateChip:: |
final public | function |