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

CliHttpCache::isNotModified()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\QueryRepository;
6
7
final class CliHttpCache 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 2
    public function __construct(ResourceStorageInterface $storage)
15
    {
16 2
        $this->storage = $storage;
17 2
    }
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 1
    public function transfer()
31
    {
32 1
        echo '304 Not Modified' . PHP_EOL . PHP_EOL;
33 1
    }
34
}
35