c5e97d415bbe22475b100a8e351c6436d89a8427
[yaffs-website] / vendor / symfony / http-foundation / Session / Storage / Proxy / SessionHandlerProxy.php
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 /**
15  * SessionHandler proxy.
16  *
17  * @author Drak <drak@zikula.org>
18  */
19 class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface
20 {
21     /**
22      * @var \SessionHandlerInterface
23      */
24     protected $handler;
25
26     /**
27      * Constructor.
28      *
29      * @param \SessionHandlerInterface $handler
30      */
31     public function __construct(\SessionHandlerInterface $handler)
32     {
33         $this->handler = $handler;
34         $this->wrapper = ($handler instanceof \SessionHandler);
35         $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user';
36     }
37
38     // \SessionHandlerInterface
39
40     /**
41      * {@inheritdoc}
42      */
43     public function open($savePath, $sessionName)
44     {
45         return (bool) $this->handler->open($savePath, $sessionName);
46     }
47
48     /**
49      * {@inheritdoc}
50      */
51     public function close()
52     {
53         return (bool) $this->handler->close();
54     }
55
56     /**
57      * {@inheritdoc}
58      */
59     public function read($sessionId)
60     {
61         return (string) $this->handler->read($sessionId);
62     }
63
64     /**
65      * {@inheritdoc}
66      */
67     public function write($sessionId, $data)
68     {
69         return (bool) $this->handler->write($sessionId, $data);
70     }
71
72     /**
73      * {@inheritdoc}
74      */
75     public function destroy($sessionId)
76     {
77         return (bool) $this->handler->destroy($sessionId);
78     }
79
80     /**
81      * {@inheritdoc}
82      */
83     public function gc($maxlifetime)
84     {
85         return (bool) $this->handler->gc($maxlifetime);
86     }
87 }