Completed
Push — master ( 2fc4c7...b0bc56 )
by Sebastian
03:38
created

Range   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 68
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getStart() 0 4 1
A getEnd() 0 4 1
A keep() 0 4 1
1
<?php
2
namespace phpbu\App\Backup\Cleaner\Stepwise;
3
4
use phpbu\App\Backup\File;
5
6
/**
7
 * Range with start and end date.
8
 *
9
 * @package    phpbu
10
 * @subpackage Backup
11
 * @author     Sebastian Feldmann <[email protected]>
12
 * @copyright  Sebastian Feldmann <[email protected]>
13
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
14
 * @link       http://phpbu.de/
15
 * @since      Class available since Release 5.0.0
16
 */
17
class Range
18
{
19
    /**
20
     * Start timestamp.
21
     *
22
     * @var int
23
     */
24
    private $start;
25
26
    /**
27
     * End timestamp.
28
     *
29
     * @var int
30
     */
31
    private $end;
32
33
    /**
34
     * Keeper decides if file should be deleted.
35
     *
36
     * @var \phpbu\App\Backup\Cleaner\Stepwise\Keeper
37
     */
38
    private $keeper;
39
40
    /**
41
     * Range constructor.
42
     *
43
     * @param int                                       $start
44
     * @param int                                       $end
45
     * @param \phpbu\App\Backup\Cleaner\Stepwise\Keeper $keeper
46
     */
47
    public function __construct(int $start, int $end, Keeper $keeper)
48
    {
49
        $this->start  = $start;
50
        $this->end    = $end;
51
        $this->keeper = $keeper;
52
    }
53
54
    /**
55
     * Start timestamp getter.
56
     *
57
     * @return int
58
     */
59
    public function getStart() : int
60
    {
61
        return $this->start;
62
    }
63
64
    /**
65
     * End timestamp getter.
66
     *
67
     * @return int
68
     */
69
    public function getEnd() : int
70
    {
71
        return $this->end;
72
    }
73
74
    /**
75
     * Should this file be deleted.
76
     *
77
     * @param  \phpbu\App\Backup\File $file
78
     * @return bool
79
     */
80
    public function keep(File $file) : bool
81
    {
82
        return $this->keeper->keep($file);
83
    }
84
}
85