Completed
Push — 1.x ( 3debfe...435817 )
by Akihito
02:33
created

HttpCache   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 28
ccs 5
cts 8
cp 0.625
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isNotModified() 0 4 2
A transfer() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\QueryRepository;
6
7
final class HttpCache implements HttpCacheInterface
0 ignored issues
show
Deprecated Code introduced by
The interface BEAR\QueryRepository\HttpCacheInterface has been deprecated with message: Use \BEAR\Sunday\Extension\Transfer\HttpCacheInterface instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
8
{
9
    /**
10
     * @var ResourceStorageInterface
11
     */
12
    private $storage;
13
14 13
    public function __construct(ResourceStorageInterface $storage)
15
    {
16 13
        $this->storage = $storage;
17 13
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 2
    public function isNotModified(array $server) : bool
23
    {
24 2
        return isset($server['HTTP_IF_NONE_MATCH']) && $this->storage->hasEtag($server['HTTP_IF_NONE_MATCH']);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function transfer()
31
    {
32
        \http_response_code(304);
33
    }
34
}
35