You are here

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 {

  /**
   * @var string
   */
  protected $name;

  /**
   * @var string
   */
  protected $mail;

  /**
   * For use in slave init field.
   *
   * @var string
   */
  protected $uid;

  /**
   * @var array|mixed
   */
  private $extra;
  public final function __construct($name, $mail, $uid, $extra = []) {
    $this->name = $name;
    $this->mail = $mail;
    $this->uid = $uid;
    $this->extra = $extra;
  }

  /**
   * {@inheritDoc}
   */
  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';
  }

}

Classes

Namesort descending Description
GingerbreadReturn