annotate vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 1fec387a4317
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of the Symfony package.
Chris@0 5 *
Chris@0 6 * (c) Fabien Potencier <fabien@symfony.com>
Chris@0 7 *
Chris@0 8 * For the full copyright and license information, please view the LICENSE
Chris@0 9 * file that was distributed with this source code.
Chris@0 10 */
Chris@0 11
Chris@0 12 namespace Symfony\Component\HttpKernel\HttpCache;
Chris@0 13
Chris@0 14 use Symfony\Component\HttpFoundation\Request;
Chris@0 15 use Symfony\Component\HttpFoundation\Response;
Chris@0 16
Chris@0 17 interface SurrogateInterface
Chris@0 18 {
Chris@0 19 /**
Chris@0 20 * Returns surrogate name.
Chris@0 21 *
Chris@0 22 * @return string
Chris@0 23 */
Chris@0 24 public function getName();
Chris@0 25
Chris@0 26 /**
Chris@0 27 * Returns a new cache strategy instance.
Chris@0 28 *
Chris@0 29 * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance
Chris@0 30 */
Chris@0 31 public function createCacheStrategy();
Chris@0 32
Chris@0 33 /**
Chris@0 34 * Checks that at least one surrogate has Surrogate capability.
Chris@0 35 *
Chris@0 36 * @return bool true if one surrogate has Surrogate capability, false otherwise
Chris@0 37 */
Chris@0 38 public function hasSurrogateCapability(Request $request);
Chris@0 39
Chris@0 40 /**
Chris@0 41 * Adds Surrogate-capability to the given Request.
Chris@0 42 */
Chris@0 43 public function addSurrogateCapability(Request $request);
Chris@0 44
Chris@0 45 /**
Chris@0 46 * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate.
Chris@0 47 *
Chris@0 48 * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags.
Chris@0 49 */
Chris@0 50 public function addSurrogateControl(Response $response);
Chris@0 51
Chris@0 52 /**
Chris@0 53 * Checks that the Response needs to be parsed for Surrogate tags.
Chris@0 54 *
Chris@0 55 * @return bool true if the Response needs to be parsed, false otherwise
Chris@0 56 */
Chris@0 57 public function needsParsing(Response $response);
Chris@0 58
Chris@0 59 /**
Chris@0 60 * Renders a Surrogate tag.
Chris@0 61 *
Chris@0 62 * @param string $uri A URI
Chris@0 63 * @param string $alt An alternate URI
Chris@0 64 * @param bool $ignoreErrors Whether to ignore errors or not
Chris@0 65 * @param string $comment A comment to add as an esi:include tag
Chris@0 66 *
Chris@0 67 * @return string
Chris@0 68 */
Chris@0 69 public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '');
Chris@0 70
Chris@0 71 /**
Chris@0 72 * Replaces a Response Surrogate tags with the included resource content.
Chris@0 73 *
Chris@0 74 * @return Response
Chris@0 75 */
Chris@0 76 public function process(Request $request, Response $response);
Chris@0 77
Chris@0 78 /**
Chris@0 79 * Handles a Surrogate from the cache.
Chris@0 80 *
Chris@0 81 * @param HttpCache $cache An HttpCache instance
Chris@0 82 * @param string $uri The main URI
Chris@0 83 * @param string $alt An alternative URI
Chris@0 84 * @param bool $ignoreErrors Whether to ignore errors or not
Chris@0 85 *
Chris@0 86 * @return string
Chris@0 87 *
Chris@0 88 * @throws \RuntimeException
Chris@0 89 * @throws \Exception
Chris@0 90 */
Chris@0 91 public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors);
Chris@0 92 }