{
private $bag;
private $data;
- private $hasBeenStarted;
+ private $usageIndex;
- public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted)
+ public function __construct(SessionBagInterface $bag, array &$data, &$usageIndex)
{
$this->bag = $bag;
$this->data = &$data;
- $this->hasBeenStarted = &$hasBeenStarted;
+ $this->usageIndex = &$usageIndex;
}
/**
*/
public function getBag()
{
+ ++$this->usageIndex;
+
return $this->bag;
}
*/
public function isEmpty()
{
+ if (!isset($this->data[$this->bag->getStorageKey()])) {
+ return true;
+ }
+ ++$this->usageIndex;
+
return empty($this->data[$this->bag->getStorageKey()]);
}
*/
public function initialize(array &$array)
{
- $this->hasBeenStarted = true;
+ ++$this->usageIndex;
$this->data[$this->bag->getStorageKey()] = &$array;
$this->bag->initialize($array);