You are here

class GingerbreadReturn in Bakery Single Sign-On System 8.2

Hierarchy

Expanded class hierarchy of GingerbreadReturn

2 files declare their use of GingerbreadReturn
GingerbreadReturnTest.php in tests/src/Unit/Cookies/GingerbreadReturnTest.php
MainController.php in src/Controller/MainController.php
Router call back functions for bakery SSO functions.

File

src/Cookies/GingerbreadReturn.php, line 5

Namespace

Drupal\bakery\Cookies
View source
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';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GingerbreadReturn::$extra private property
GingerbreadReturn::$mail protected property
GingerbreadReturn::$name protected property
GingerbreadReturn::$uid protected property For use in slave init field.
GingerbreadReturn::fromData public static function Create from data stored in a cookie. Overrides CookieInterface::fromData
GingerbreadReturn::getName public static function Get the cookie name/type. Overrides CookieInterface::getName
GingerbreadReturn::toData public function Convert the data into an array to be stored into a cookie. Overrides CookieInterface::toData
GingerbreadReturn::__construct final public function