Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 399
Zeile 27... Zeile 27...
27
    protected $root;
27
    protected $root;
28
    /** @var \SplObjectStorage<Request, string> */
28
    /** @var \SplObjectStorage<Request, string> */
29
    private \SplObjectStorage $keyCache;
29
    private \SplObjectStorage $keyCache;
30
    /** @var array<string, resource> */
30
    /** @var array<string, resource> */
31
    private array $locks = [];
31
    private array $locks = [];
-
 
32
    private array $options;
Zeile 32... Zeile 33...
32
 
33
 
-
 
34
    /**
-
 
35
     * Constructor.
-
 
36
     *
-
 
37
     * The available options are:
-
 
38
     *
-
 
39
     *   * private_headers  Set of response headers that should not be stored
-
 
40
     *                      when a response is cached. (default: Set-Cookie)
33
    /**
41
     *
34
     * @throws \RuntimeException
42
     * @throws \RuntimeException
35
     */
43
     */
36
    public function __construct(string $root)
44
    public function __construct(string $root, array $options = [])
37
    {
45
    {
38
        $this->root = $root;
46
        $this->root = $root;
39
        if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) {
47
        if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) {
40
            throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
48
            throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
41
        }
49
        }
-
 
50
        $this->keyCache = new \SplObjectStorage();
-
 
51
        $this->options = array_merge([
-
 
52
            'private_headers' => ['Set-Cookie'],
42
        $this->keyCache = new \SplObjectStorage();
53
        ], $options);
Zeile 43... Zeile 54...
43
    }
54
    }
44
 
55
 
45
    /**
56
    /**
Zeile 210... Zeile 221...
210
        }
221
        }
Zeile 211... Zeile 222...
211
 
222
 
212
        $headers = $this->persistResponse($response);
223
        $headers = $this->persistResponse($response);
Zeile -... Zeile 224...
-
 
224
        unset($headers['age']);
-
 
225
 
-
 
226
        foreach ($this->options['private_headers'] as $h) {
-
 
227
            unset($headers[strtolower($h)]);
213
        unset($headers['age']);
228
        }
Zeile 214... Zeile 229...
214
 
229
 
215
        array_unshift($entries, [$storedEnv, $headers]);
230
        array_unshift($entries, [$storedEnv, $headers]);
216
 
231