Client   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 11 2
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Adapter\FileSystem;
12
13
use FeedIo\Adapter\ClientInterface;
14
use FeedIo\Adapter\NotFoundException;
15
use FeedIo\Adapter\ResponseInterface;
16
17
/**
18
 * Filesystem client
19
 */
20
class Client implements ClientInterface
21
{
22
23
    /**
24
     * @param  string                            $path
25
     * @param  \DateTime                         $modifiedSince
26
     * @throws \FeedIo\Adapter\NotFoundException
27
     * @return \FeedIo\Adapter\ResponseInterface
28
     */
29 2
    public function getResponse(string $path, \DateTime $modifiedSince) : ResponseInterface
30
    {
31 2
        if (file_exists($path)) {
32 1
            return new Response(
33 1
                file_get_contents($path),
34 1
                new \DateTime('@'.filemtime($path))
35
            );
36
        }
37
38 1
        throw new NotFoundException($path);
39
    }
40
}
41