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\Proxy;
13
 
14
use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
15
 
16
/**
17
 * @author Drak <drak@zikula.org>
18
 */
19
class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface
20
{
21
    protected $handler;
22
 
23
    public function __construct(\SessionHandlerInterface $handler)
24
    {
25
        $this->handler = $handler;
26
        $this->wrapper = $handler instanceof \SessionHandler;
27
        $this->saveHandlerName = $this->wrapper || ($handler instanceof StrictSessionHandler && $handler->isWrapper()) ? \ini_get('session.save_handler') : 'user';
28
    }
29
 
30
    public function getHandler(): \SessionHandlerInterface
31
    {
32
        return $this->handler;
33
    }
34
 
35
    // \SessionHandlerInterface
36
 
37
    public function open(string $savePath, string $sessionName): bool
38
    {
39
        return $this->handler->open($savePath, $sessionName);
40
    }
41
 
42
    public function close(): bool
43
    {
44
        return $this->handler->close();
45
    }
46
 
47
    public function read(string $sessionId): string|false
48
    {
49
        return $this->handler->read($sessionId);
50
    }
51
 
52
    public function write(string $sessionId, string $data): bool
53
    {
54
        return $this->handler->write($sessionId, $data);
55
    }
56
 
57
    public function destroy(string $sessionId): bool
58
    {
59
        return $this->handler->destroy($sessionId);
60
    }
61
 
62
    public function gc(int $maxlifetime): int|false
63
    {
64
        return $this->handler->gc($maxlifetime);
65
    }
66
 
67
    public function validateId(string $sessionId): bool
68
    {
69
        return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId);
70
    }
71
 
72
    public function updateTimestamp(string $sessionId, string $data): bool
73
    {
74
        return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data);
75
    }
76
}