package and depencies
This commit is contained in:
30
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
30
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
@@ -26,9 +26,9 @@ class Store implements StoreInterface
|
||||
{
|
||||
protected $root;
|
||||
/** @var \SplObjectStorage<Request, string> */
|
||||
private $keyCache;
|
||||
private \SplObjectStorage $keyCache;
|
||||
/** @var array<string, resource> */
|
||||
private $locks = [];
|
||||
private array $locks = [];
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
@@ -61,7 +61,7 @@ class Store implements StoreInterface
|
||||
*
|
||||
* @return bool|string true if the lock is acquired, the path to the current lock otherwise
|
||||
*/
|
||||
public function lock(Request $request)
|
||||
public function lock(Request $request): bool|string
|
||||
{
|
||||
$key = $this->getCacheKey($request);
|
||||
|
||||
@@ -88,7 +88,7 @@ class Store implements StoreInterface
|
||||
*
|
||||
* @return bool False if the lock file does not exist or cannot be unlocked, true otherwise
|
||||
*/
|
||||
public function unlock(Request $request)
|
||||
public function unlock(Request $request): bool
|
||||
{
|
||||
$key = $this->getCacheKey($request);
|
||||
|
||||
@@ -103,7 +103,7 @@ class Store implements StoreInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isLocked(Request $request)
|
||||
public function isLocked(Request $request): bool
|
||||
{
|
||||
$key = $this->getCacheKey($request);
|
||||
|
||||
@@ -125,10 +125,8 @@ class Store implements StoreInterface
|
||||
|
||||
/**
|
||||
* Locates a cached Response for the Request provided.
|
||||
*
|
||||
* @return Response|null
|
||||
*/
|
||||
public function lookup(Request $request)
|
||||
public function lookup(Request $request): ?Response
|
||||
{
|
||||
$key = $this->getCacheKey($request);
|
||||
|
||||
@@ -167,11 +165,9 @@ class Store implements StoreInterface
|
||||
* Existing entries are read and any that match the response are removed. This
|
||||
* method calls write with the new list of cache entries.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function write(Request $request, Response $response)
|
||||
public function write(Request $request, Response $response): string
|
||||
{
|
||||
$key = $this->getCacheKey($request);
|
||||
$storedEnv = $this->persistRequest($request);
|
||||
@@ -227,12 +223,10 @@ class Store implements StoreInterface
|
||||
|
||||
/**
|
||||
* Returns content digest for $response.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateContentDigest(Response $response)
|
||||
protected function generateContentDigest(Response $response): string
|
||||
{
|
||||
return 'en'.hash('sha256', $response->getContent());
|
||||
return 'en'.hash('xxh128', $response->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -309,7 +303,7 @@ class Store implements StoreInterface
|
||||
*
|
||||
* @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise
|
||||
*/
|
||||
public function purge(string $url)
|
||||
public function purge(string $url): bool
|
||||
{
|
||||
$http = preg_replace('#^https:#', 'http:', $url);
|
||||
$https = preg_replace('#^http:#', 'https:', $url);
|
||||
@@ -418,10 +412,8 @@ class Store implements StoreInterface
|
||||
* If the same URI can have more than one representation, based on some
|
||||
* headers, use a Vary header to indicate them, and each representation will
|
||||
* be stored independently under the same cache key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateCacheKey(Request $request)
|
||||
protected function generateCacheKey(Request $request): string
|
||||
{
|
||||
return 'md'.hash('sha256', $request->getUri());
|
||||
}
|
||||
|
Reference in New Issue
Block a user