| 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\Request;
|
|
|
15 |
|
|
|
16 |
// Help opcache.preload discover always-needed symbols
|
|
|
17 |
class_exists(MockFileSessionStorage::class);
|
|
|
18 |
|
|
|
19 |
/**
|
|
|
20 |
* @author Jérémy Derussé <jeremy@derusse.com>
|
|
|
21 |
*/
|
|
|
22 |
class MockFileSessionStorageFactory implements SessionStorageFactoryInterface
|
|
|
23 |
{
|
|
|
24 |
private ?string $savePath;
|
|
|
25 |
private string $name;
|
|
|
26 |
private ?MetadataBag $metaBag;
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* @see MockFileSessionStorage constructor.
|
|
|
30 |
*/
|
|
|
31 |
public function __construct(string $savePath = null, string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
|
|
|
32 |
{
|
|
|
33 |
$this->savePath = $savePath;
|
|
|
34 |
$this->name = $name;
|
|
|
35 |
$this->metaBag = $metaBag;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
public function createStorage(?Request $request): SessionStorageInterface
|
|
|
39 |
{
|
|
|
40 |
return new MockFileSessionStorage($this->savePath, $this->name, $this->metaBag);
|
|
|
41 |
}
|
|
|
42 |
}
|