| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\HttpFoundation\Session\Storage; |
| 13 |
|
| 14 |
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
class PhpBridgeSessionStorage extends NativeSessionStorage |
| 22 |
{ |
| 23 |
public function __construct(AbstractProxy|\SessionHandlerInterface|null $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(): void |
| 45 |
{ |
| 46 |
|
| 47 |
|
| 48 |
foreach ($this->bags as $bag) { |
| 49 |
$bag->clear(); |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
$this->loadSession(); |
| 54 |
} |
| 55 |
} |