comparison vendor/symfony/http-foundation/Session/SessionBagProxy.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children c2387f117808
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\HttpFoundation\Session;
13
14 /**
15 * @author Nicolas Grekas <p@tchwork.com>
16 *
17 * @internal
18 */
19 final class SessionBagProxy implements SessionBagInterface
20 {
21 private $bag;
22 private $data;
23 private $hasBeenStarted;
24
25 public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted)
26 {
27 $this->bag = $bag;
28 $this->data = &$data;
29 $this->hasBeenStarted = &$hasBeenStarted;
30 }
31
32 /**
33 * @return SessionBagInterface
34 */
35 public function getBag()
36 {
37 return $this->bag;
38 }
39
40 /**
41 * @return bool
42 */
43 public function isEmpty()
44 {
45 return empty($this->data[$this->bag->getStorageKey()]);
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function getName()
52 {
53 return $this->bag->getName();
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 public function initialize(array &$array)
60 {
61 $this->hasBeenStarted = true;
62 $this->data[$this->bag->getStorageKey()] = &$array;
63
64 $this->bag->initialize($array);
65 }
66
67 /**
68 * {@inheritdoc}
69 */
70 public function getStorageKey()
71 {
72 return $this->bag->getStorageKey();
73 }
74
75 /**
76 * {@inheritdoc}
77 */
78 public function clear()
79 {
80 return $this->bag->clear();
81 }
82 }