*/ class MetadataBag implements SessionBagInterface { public const CREATED = 'c'; public const UPDATED = 'u'; public const LIFETIME = 'l'; private string $name = '__metadata'; private string $storageKey; /** @var array */ protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0]; /** Unix timestamp. */ private int $lastUsed; private int $updateThreshold; /** * @param string $storageKey The key used to store bag in the session * @param int $updateThreshold The time to wait between two UPDATED updates */ public function __construct(string $storageKey = '_sf2_meta', int $updateThreshold = 0) { $this->storageKey = $storageKey; $this->updateThreshold = $updateThreshold; } /** * {@inheritdoc} */ public function initialize(array &$array) { $this->meta = &$array; if (isset($array[self::CREATED])) { $this->lastUsed = $this->meta[self::UPDATED]; $timeStamp = time(); if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) { $this->meta[self::UPDATED] = $timeStamp; } } else { $this->stampCreated(); } } /** * Gets the lifetime that the session cookie was set with. */ public function getLifetime(): int { return $this->meta[self::LIFETIME]; } /** * Stamps a new session's metadata. * * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value * will leave the system settings unchanged, 0 sets the cookie * to expire with browser session. Time is in seconds, and is * not a Unix timestamp. */ public function stampNew(int $lifetime = null) { $this->stampCreated($lifetime); } /** * {@inheritdoc} */ public function getStorageKey(): string { return $this->storageKey; } /** * Gets the created timestamp metadata. * * @return int Unix timestamp */ public function getCreated(): int { return $this->meta[self::CREATED]; } /** * Gets the last used metadata. * * @return int Unix timestamp */ public function getLastUsed(): int { return $this->lastUsed; } /** * {@inheritdoc} */ public function clear(): mixed { // nothing to do return null; } /** * {@inheritdoc} */ public function getName(): string { return $this->name; } /** * Sets name. */ public function setName(string $name) { $this->name = $name; } private function stampCreated(int $lifetime = null): void { $timeStamp = time(); $this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp; $this->meta[self::LIFETIME] = $lifetime ?? (int) \ini_get('session.cookie_lifetime'); } } __halt_compiler();----SIGNATURE:----gw2Jl4PBNGRxlG/xiiUhLnWgmr5iMO5Ka7TG524tAxnscU1d8JVBcqvo/qsfYeXh/+MIwzXbSopsRBMfNC474ZDwyElk20Pz9kJ/ObFMIZbRn/ThRp2ISfk5seKPQTIoxGeHyYIoWUZ1btJSJmspV2VOT4uFc6EykRF4u0TmKS8urjWt1jaTM5DHbPLAUnSVSHOd5lsKhnoFzN306SX9LUUxniYb4zD0uO0JvCePN1PY5RgNzlf5ENhLwIpJ4WIs1oeS0Qe6OHW/BmnjZhPuHYDRDgD4Q2nX2/qnK6ZdoSRRBqZTjW3+S+vxP40eli7m0cBUlbs0tMR7WsNQsQASS4ODN+DT1x8DNwlEHUXG9EQQNFSTaYm7Lz6H8+Eg+7r4uBle2ajUBzISGcowMmk8IMdexvmt5tNDHri6iaDA0osfxbnhD8XFHuOQ4Ei84bJTLautuS4Stv6IdvtlT/ZVx/Pphs9NMGsG2+AdOWxUYXkV0mNtdx2gUvS1cjdvPa5MbNJEc6jWyHduxoIiCE2DD7Nn7CJa475+Y1P1XpXY9+9w2To58L7EibMOWqDjOEAnfIXpt7N9A1+QKJWv6weddOLdSti8QXYdxoofajMArjTmyK4+gtHXENhFDoI4wrStfd3vdkCwkeqXeXJkjo4a51QnPeTEOkk1qohOJPgLLLU=----ATTACHMENT:----OTY1NDgwNTYwOTExMDk4MCA1Nzc1NTU0NDUxMjQ5MDExIDExNzI0NjIxODEyMDEzNjc=