1313use BadMethodCallException ;
1414use Closure ;
1515use Illuminate \Contracts \Config \Repository as Config ;
16- use Illuminate \Contracts \Routing \UrlGenerator ;
17- use Illuminate \Contracts \Routing \UrlRoutable ;
16+ use Illuminate \Contracts \Routing \{UrlGenerator , UrlRoutable };
1817use Illuminate \Http \Request ;
19- use Illuminate \Support \Carbon ;
20- use Illuminate \Support \Collection ;
18+ use Illuminate \Support \{Carbon , Collection };
2119use Matchory \ResponseCache \Contracts \CacheStrategy ;
2220use Psr \SimpleCache \InvalidArgumentException ;
2321use Stringable ;
@@ -56,7 +54,7 @@ class ResponseCache
5654 /**
5755 * Creates a new response cache instance.
5856 *
59- * @param callable(): Config $configResolver
57+ * @param callable(): Config $configResolver
6058 *
6159 * @internal Should only be invoked by the DI container
6260 */
@@ -73,9 +71,10 @@ public function __construct(
7371 * Retrieves a response from the cache. If there is no cached response for
7472 * the given request, `null` will be returned.
7573 *
76- * @param Request $request Request to retrieve a response from the
77- * cache for
78- * @param string[]|null $tags Tags the cache entry is tagged with
74+ * @param Request $request Request to retrieve a response from the
75+ * cache for
76+ * @param string[]|null $tags Tags the cache entry is tagged with
77+ *
7978 * @return Response|null Response if cached, `null` otherwise
8079 *
8180 * @throws BadMethodCallException
@@ -93,8 +92,8 @@ public function get(Request $request, array|null $tags = null): Response|null
9392 * Deletes one or more specific URLs from the cache. Note that this can't
9493 * take bound parameters or tags specific to request instances into account.
9594 *
96- * @param string|string[] $uri URI or URIs to remove from the cache.
97- * @param string[] $tags Tags to flush the cache for.
95+ * @param string|string[] $uri URI or URIs to remove from the cache.
96+ * @param string[] $tags Tags to flush the cache for.
9897 *
9998 * @throws BadMethodCallException
10099 * @throws InvalidArgumentException
@@ -128,7 +127,7 @@ public function enabled(): bool
128127 /**
129128 * Flushes all cached items, or all items with one or more tags.
130129 *
131- * @param string[]|null $tags Tags to flush. Pass `null` to flush all tags.
130+ * @param string[]|null $tags Tags to flush. Pass `null` to flush all tags.
132131 *
133132 * @throws BadMethodCallException
134133 */
@@ -142,8 +141,9 @@ public function flush(array|null $tags = null): void
142141 /**
143142 * Checks whether the response for a request has already been cached.
144143 *
145- * @param Request $request Request to check the cache status for
146- * @param string[]|null $tags Tags the cached entry is tagged with
144+ * @param Request $request Request to check the cache status for
145+ * @param string[]|null $tags Tags the cached entry is tagged with
146+ *
147147 * @return bool `true` if a cached response exists, `false` otherwise
148148 *
149149 * @throws BadMethodCallException
@@ -160,10 +160,10 @@ public function has(Request $request, array|null $tags = null): bool
160160 /**
161161 * Caches the response to a given request, if it matches the cache strategy.
162162 *
163- * @param Request $request Request to cache a response for
164- * @param Response $response Response to cache
165- * @param string[]|null $tags Tags to tag the cache entry with
166- * @param int|null $ttl Time-to-live for the cache entry
163+ * @param Request $request Request to cache a response for
164+ * @param Response $response Response to cache
165+ * @param string[]|null $tags Tags to tag the cache entry with
166+ * @param int|null $ttl Time-to-live for the cache entry
167167 *
168168 * @throws BadMethodCallException
169169 */
@@ -180,7 +180,7 @@ public function put(
180180
181181 // The strategy has ultimate control over whether responses shall be
182182 // added to the cache
183- if (! $ this ->strategy ->shouldCache ($ request , $ response )) {
183+ if (!$ this ->strategy ->shouldCache ($ request , $ response )) {
184184 return ;
185185 }
186186
@@ -201,12 +201,13 @@ public function put(
201201 /**
202202 * Adds original cache timing information to the response, if enabled.
203203 *
204- * @param Response $response Response instance to add the information to.
204+ * @param Response $response Response instance to add the information to.
205+ *
205206 * @return Response New response instance with the header applied to.
206207 */
207208 protected function addServerTiming (Response $ response ): Response
208209 {
209- if (! $ this ->config ()->get ('response-cache.server_timing ' )) {
210+ if (!$ this ->config ()->get ('response-cache.server_timing ' )) {
210211 return $ response ;
211212 }
212213
@@ -226,7 +227,7 @@ protected function addServerTiming(Response $response): Response
226227
227228 protected function addCacheStatus (Response $ response ): Response
228229 {
229- if (! $ this ->config ()->get ('response-cache.cache_status_enabled ' )) {
230+ if (!$ this ->config ()->get ('response-cache.cache_status_enabled ' )) {
230231 return $ response ;
231232 }
232233
@@ -263,8 +264,9 @@ protected function getDefaultTtl(): int|null
263264 * Note that, for this to work properly, the cache middleware _must_ run
264265 * after the SubstituteBindings middleware.
265266 *
266- * @param string $tag Tag to replace bindings in.
267- * @param Request $request Request instance to fetch bound parameters from.
267+ * @param string $tag Tag to replace bindings in.
268+ * @param Request $request Request instance to fetch bound parameters from.
269+ *
268270 * @return string Finalized tag.
269271 *
270272 * @example Assume a tag passed as "users.{user}". The route has an implicit
@@ -284,15 +286,15 @@ protected function replaceBinding(string $tag, Request $request): string
284286
285287 // If there is no opening curly brace in the tag, there's no need to run
286288 // a regular expression match
287- if (! str_contains ($ tag , '{ ' )) {
289+ if (!str_contains ($ tag , '{ ' )) {
288290 return $ tag ;
289291 }
290292
291293 // Extract all bindings from the tag. This will yield a nested array
292294 // containing all matched bindings
293295 preg_match_all ('/{.+?}/ ' , $ tag , $ matches );
294296
295- if (! isset ($ matches [0 ])) {
297+ if (!isset ($ matches [0 ])) {
296298 return $ tag ;
297299 }
298300
@@ -305,7 +307,7 @@ protected function replaceBinding(string $tag, Request $request): string
305307 ?? $ request ->get ($ name )
306308 ?? null ;
307309
308- if (! $ value ) {
310+ if (!$ value ) {
309311 continue ;
310312 }
311313
@@ -318,8 +320,8 @@ protected function replaceBinding(string $tag, Request $request): string
318320 // We can't replace non-scalar values, so to prevent errors in the
319321 // `str_replace` call below, we skip other values
320322 if (
321- ! is_scalar ($ value ) &&
322- ! ($ value instanceof Stringable)
323+ !is_scalar ($ value ) &&
324+ !($ value instanceof Stringable)
323325 ) {
324326 continue ;
325327 }
@@ -336,9 +338,10 @@ protected function replaceBinding(string $tag, Request $request): string
336338 * Resolves all tags to apply to a given request/response pair, and replaces
337339 * bound parameters in all cache tags.
338340 *
339- * @param string[]|null $tags Individual tags to add to this response.
340- * @param Request $request Request instance.
341- * @param Response|null $response Response instance.
341+ * @param string[]|null $tags Individual tags to add to this response.
342+ * @param Request $request Request instance.
343+ * @param Response|null $response Response instance.
344+ *
342345 * @return string[] List of finalized tags.
343346 */
344347 protected function resolveTags (
0 commit comments