composer package updates
[openemr.git] / vendor / symfony / http-foundation / Session / Storage / PhpBridgeSessionStorage.php
blob3a2391e762e4eecf1cede22dc4877408f76358f1
1 <?php
3 /*
4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpFoundation\Session\Storage;
14 use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
15 use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
17 /**
18 * Allows session to be started by PHP and managed by Symfony.
20 * @author Drak <drak@zikula.org>
22 class PhpBridgeSessionStorage extends NativeSessionStorage
24 /**
25 * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler
26 * @param MetadataBag $metaBag MetadataBag
28 public function __construct($handler = null, MetadataBag $metaBag = null)
30 $this->setMetadataBag($metaBag);
31 $this->setSaveHandler($handler);
34 /**
35 * {@inheritdoc}
37 public function start()
39 if ($this->started) {
40 return true;
43 $this->loadSession();
44 if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
45 // This condition matches only PHP 5.3 + internal save handlers
46 $this->saveHandler->setActive(true);
49 return true;
52 /**
53 * {@inheritdoc}
55 public function clear()
57 // clear out the bags and nothing else that may be set
58 // since the purpose of this driver is to share a handler
59 foreach ($this->bags as $bag) {
60 $bag->clear();
63 // reconnect the bags to the session
64 $this->loadSession();