You are here

Gingerbread.php in Bakery Single Sign-On System 8.2

File

src/Cookies/Gingerbread.php
View source
<?php

namespace Drupal\bakery\Cookies;

class Gingerbread implements CookieInterface, RemoteCookieInterface {
  private $name;
  private $or_email;
  private $child;
  private $uid;
  public final function __construct($name, $or_email, $child, $uid) {
    $this->name = $name;
    $this->or_email = $or_email;
    $this->child = $child;
    $this->uid = $uid;
  }

  /**
   * {@inheritDoc}
   */
  public static function fromData(array $data) {
    return new static($data['name'], $data['or_email'], $data['slave'], $data['uid']);
  }

  /**
   * {@inheritDoc}
   */
  public function toData() : array {
    return [
      'name' => $this->name,
      'or_email' => $this->or_email,
      // Match slave property are set on the main site.
      'slave' => $this->child,
      'uid' => $this->uid,
    ];
  }

  /**
   * {@inheritDoc}
   */
  public static function getName() : string {
    return 'gingerbread';
  }

  /**
   * {@inheritDoc}
   */
  public function getPath() {
    return 'bakery/create';
  }
  public function getAccountName() {
    return $this->name;
  }
  public function getOrEmail() {
    return $this->or_email;
  }
  public function getChild() {
    return $this->child;
  }
  public function getChildUid() {
    return $this->uid;
  }

}

Classes

Namesort descending Description
Gingerbread