23 class MetadataBag
implements SessionBagInterface
32 private $name =
'__metadata';
42 protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0];
54 private $updateThreshold;
60 public function __construct(
string $storageKey =
'_sf2_meta',
int $updateThreshold = 0)
62 $this->storageKey = $storageKey;
63 $this->updateThreshold = $updateThreshold;
71 $this->meta = &$array;
73 if (isset($array[self::CREATED])) {
77 if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) {
81 $this->stampCreated();
103 public function stampNew($lifetime =
null)
105 $this->stampCreated($lifetime);
113 return $this->storageKey;
133 return $this->lastUsed;
139 public function clear()
162 private function stampCreated(
int $lifetime =
null): void
166 $this->meta[
self::LIFETIME] = (
null === $lifetime) ? ini_get(
'session.cookie_lifetime') : $lifetime;