comparison vendor/symfony/http-foundation/Session/SessionBagProxy.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
18 */ 18 */
19 final class SessionBagProxy implements SessionBagInterface 19 final class SessionBagProxy implements SessionBagInterface
20 { 20 {
21 private $bag; 21 private $bag;
22 private $data; 22 private $data;
23 private $hasBeenStarted; 23 private $usageIndex;
24 24
25 public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted) 25 public function __construct(SessionBagInterface $bag, array &$data, &$usageIndex)
26 { 26 {
27 $this->bag = $bag; 27 $this->bag = $bag;
28 $this->data = &$data; 28 $this->data = &$data;
29 $this->hasBeenStarted = &$hasBeenStarted; 29 $this->usageIndex = &$usageIndex;
30 } 30 }
31 31
32 /** 32 /**
33 * @return SessionBagInterface 33 * @return SessionBagInterface
34 */ 34 */
35 public function getBag() 35 public function getBag()
36 { 36 {
37 ++$this->usageIndex;
38
37 return $this->bag; 39 return $this->bag;
38 } 40 }
39 41
40 /** 42 /**
41 * @return bool 43 * @return bool
42 */ 44 */
43 public function isEmpty() 45 public function isEmpty()
44 { 46 {
47 ++$this->usageIndex;
48
45 return empty($this->data[$this->bag->getStorageKey()]); 49 return empty($this->data[$this->bag->getStorageKey()]);
46 } 50 }
47 51
48 /** 52 /**
49 * {@inheritdoc} 53 * {@inheritdoc}
56 /** 60 /**
57 * {@inheritdoc} 61 * {@inheritdoc}
58 */ 62 */
59 public function initialize(array &$array) 63 public function initialize(array &$array)
60 { 64 {
61 $this->hasBeenStarted = true; 65 ++$this->usageIndex;
62 $this->data[$this->bag->getStorageKey()] = &$array; 66 $this->data[$this->bag->getStorageKey()] = &$array;
63 67
64 $this->bag->initialize($array); 68 $this->bag->initialize($array);
65 } 69 }
66 70
75 /** 79 /**
76 * {@inheritdoc} 80 * {@inheritdoc}
77 */ 81 */
78 public function clear() 82 public function clear()
79 { 83 {
84 ++$this->usageIndex;
85
80 return $this->bag->clear(); 86 return $this->bag->clear();
81 } 87 }
82 } 88 }