Issues (61)

src/HttpCache.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\QueryRepository;
6
7
use BEAR\QueryRepository\HttpCacheInterface as DeprecatedHttpCacheInterface;
8
use BEAR\Sunday\Extension\Transfer\HttpCacheInterface;
9
use Override;
10
11
use function http_response_code;
12
13
/** @psalm-suppress DeprecatedInterface for BC */
14
final readonly class HttpCache implements HttpCacheInterface, DeprecatedHttpCacheInterface
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_READONLY, expecting T_CLASS on line 14 at column 6
Loading history...
15
{
16
    public function __construct(
17
        private ResourceStorageInterface $storage,
18
    ) {
19
    }
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    #[Override]
25
    public function isNotModified(array $server): bool
26
    {
27
        return isset($server[Header::HTTP_IF_NONE_MATCH]) && $this->storage->hasEtag($server[Header::HTTP_IF_NONE_MATCH]);
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     *
33
     * @return void
34
     */
35
    #[Override]
36
    public function transfer()
37
    {
38
        // @codeCoverageIgnoreStart
39
        http_response_code(304);
40
        // @codeCoverageIgnoreEnd
41
    }
42
}
43