GingerbreadReturn.php in Bakery Single Sign-On System 8.2
File
src/Cookies/GingerbreadReturn.php
View source
<?php
namespace Drupal\bakery\Cookies;
class GingerbreadReturn implements CookieInterface {
protected $name;
protected $mail;
protected $uid;
private $extra;
public final function __construct($name, $mail, $uid, $extra = []) {
$this->name = $name;
$this->mail = $mail;
$this->uid = $uid;
$this->extra = $extra;
}
public static function fromData(array $data) {
return new static($data['name'] ?? '', $data['mail'] ?? '', $data['uid'] ?? '');
}
public function toData() : array {
$data = [];
foreach ($this->extra as $k => $v) {
$data[$k] = $v;
}
return [
'name' => $this->name,
'mail' => $this->mail,
'uid' => $this->uid,
] + $data;
}
public static function getName() : string {
return 'gingerbread';
}
}