Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 1fec387a4317 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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\HttpKernel\HttpCache; | |
13 | |
14 use Symfony\Component\HttpFoundation\Request; | |
15 use Symfony\Component\HttpFoundation\Response; | |
16 | |
17 interface SurrogateInterface | |
18 { | |
19 /** | |
20 * Returns surrogate name. | |
21 * | |
22 * @return string | |
23 */ | |
24 public function getName(); | |
25 | |
26 /** | |
27 * Returns a new cache strategy instance. | |
28 * | |
29 * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance | |
30 */ | |
31 public function createCacheStrategy(); | |
32 | |
33 /** | |
34 * Checks that at least one surrogate has Surrogate capability. | |
35 * | |
36 * @param Request $request A Request instance | |
37 * | |
38 * @return bool true if one surrogate has Surrogate capability, false otherwise | |
39 */ | |
40 public function hasSurrogateCapability(Request $request); | |
41 | |
42 /** | |
43 * Adds Surrogate-capability to the given Request. | |
44 * | |
45 * @param Request $request A Request instance | |
46 */ | |
47 public function addSurrogateCapability(Request $request); | |
48 | |
49 /** | |
50 * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate. | |
51 * | |
52 * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags. | |
53 * | |
54 * @param Response $response A Response instance | |
55 */ | |
56 public function addSurrogateControl(Response $response); | |
57 | |
58 /** | |
59 * Checks that the Response needs to be parsed for Surrogate tags. | |
60 * | |
61 * @param Response $response A Response instance | |
62 * | |
63 * @return bool true if the Response needs to be parsed, false otherwise | |
64 */ | |
65 public function needsParsing(Response $response); | |
66 | |
67 /** | |
68 * Renders a Surrogate tag. | |
69 * | |
70 * @param string $uri A URI | |
71 * @param string $alt An alternate URI | |
72 * @param bool $ignoreErrors Whether to ignore errors or not | |
73 * @param string $comment A comment to add as an esi:include tag | |
74 * | |
75 * @return string | |
76 */ | |
77 public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = ''); | |
78 | |
79 /** | |
80 * Replaces a Response Surrogate tags with the included resource content. | |
81 * | |
82 * @param Request $request A Request instance | |
83 * @param Response $response A Response instance | |
84 * | |
85 * @return Response | |
86 */ | |
87 public function process(Request $request, Response $response); | |
88 | |
89 /** | |
90 * Handles a Surrogate from the cache. | |
91 * | |
92 * @param HttpCache $cache An HttpCache instance | |
93 * @param string $uri The main URI | |
94 * @param string $alt An alternative URI | |
95 * @param bool $ignoreErrors Whether to ignore errors or not | |
96 * | |
97 * @return string | |
98 * | |
99 * @throws \RuntimeException | |
100 * @throws \Exception | |
101 */ | |
102 public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors); | |
103 } |