Completed
Push — issue/60 ( b48df4 )
by Alex
04:17
created

ModifiedSince   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 30
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isValid() 0 8 2
1
<?php
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\Filter;
12
13
use FeedIo\FeedInterface;
14
use FeedIo\Feed\ItemInterface;
15
use FeedIo\FilterInterface;
16
17
class ModifiedSince implements FilterInterface
18
{
19
    /**
20
     * @var \DateTime
21
     */
22
    protected $date;
23
24
    /**
25
     * ModifiedSince constructor.
26
     * @param \DateTime $date
27
     */
28 3
    public function __construct(\DateTime $date)
29
    {
30 3
        $this->date = $date;
31 3
    }
32
33
34
    /**
35
     * @param  ItemInterface $item
36
     * @return bool
37
     */
38 3
    public function isValid(ItemInterface $item)
39
    {
40 3
        if ($item->getLastModified() instanceof \DateTime) {
41 2
            return $item->getLastModified() > $this->date;
42
        }
43
44 1
        return false;
45
    }
46
}
47