Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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\Storage;
13
 
14
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
15
 
16
/**
17
 * Allows session to be started by PHP and managed by Symfony.
18
 *
19
 * @author Drak <drak@zikula.org>
20
 */
21
class PhpBridgeSessionStorage extends NativeSessionStorage
22
{
23
    public function __construct(AbstractProxy|\SessionHandlerInterface $handler = null, MetadataBag $metaBag = null)
24
    {
25
        if (!\extension_loaded('session')) {
26
            throw new \LogicException('PHP extension "session" is required.');
27
        }
28
 
29
        $this->setMetadataBag($metaBag);
30
        $this->setSaveHandler($handler);
31
    }
32
 
33
    public function start(): bool
34
    {
35
        if ($this->started) {
36
            return true;
37
        }
38
 
39
        $this->loadSession();
40
 
41
        return true;
42
    }
43
 
44
    public function clear()
45
    {
46
        // clear out the bags and nothing else that may be set
47
        // since the purpose of this driver is to share a handler
48
        foreach ($this->bags as $bag) {
49
            $bag->clear();
50
        }
51
 
52
        // reconnect the bags to the session
53
        $this->loadSession();
54
    }
55
}