PluginProbe
WPIDE – File Manager & Code Editor / 3.5.10
WPIDE – File Manager & Code Editor v3.5.10
3.5.10 3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 All 56 releases
wpide / vendor / symfony / http-foundation / Session / Storage / Proxy / AbstractProxy.php

AbstractProxy.php in WPIDE – File Manager & Code Editor 3.5.10, at vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php

119 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
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 * @author Drak <[email protected]>
16 */
17 abstract class AbstractProxy
18 {
19 /**
20 * Flag if handler wraps an internal PHP session handler (using \SessionHandler).
21 *
22 * @var bool
23 */
24 protected $wrapper = false;
25
26 /**
27 * @var string
28 */
29 protected $saveHandlerName;
30
31 /**
32 * Gets the session.save_handler name.
33 *
34 * @return string|null
35 */
36 public function getSaveHandlerName()
37 {
38 return $this->saveHandlerName;
39 }
40
41 /**
42 * Is this proxy handler and instance of \SessionHandlerInterface.
43 *
44 * @return bool
45 */
46 public function isSessionHandlerInterface()
47 {
48 return $this instanceof \SessionHandlerInterface;
49 }
50
51 /**
52 * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
53 *
54 * @return bool
55 */
56 public function isWrapper()
57 {
58 return $this->wrapper;
59 }
60
61 /**
62 * Has a session started?
63 *
64 * @return bool
65 */
66 public function isActive()
67 {
68 return \PHP_SESSION_ACTIVE === session_status();
69 }
70
71 /**
72 * Gets the session ID.
73 *
74 * @return string
75 */
76 public function getId()
77 {
78 return session_id();
79 }
80
81 /**
82 * Sets the session ID.
83 *
84 * @throws \LogicException
85 */
86 public function setId(string $id)
87 {
88 if ($this->isActive()) {
89 throw new \LogicException('Cannot change the ID of an active session.');
90 }
91
92 session_id($id);
93 }
94
95 /**
96 * Gets the session name.
97 *
98 * @return string
99 */
100 public function getName()
101 {
102 return session_name();
103 }
104
105 /**
106 * Sets the session name.
107 *
108 * @throws \LogicException
109 */
110 public function setName(string $name)
111 {
112 if ($this->isActive()) {
113 throw new \LogicException('Cannot change the name of an active session.');
114 }
115
116 session_name($name);
117 }
118 }
119