Completed
Push — master ( b7fe7e...4bccf1 )
by Peter
01:34
created

EverydayRule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 6
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 */
8
9
namespace AnimeDb\SmartSleep\Rule;
10
11 View Code Duplication
class EverydayRule implements HourIntervalRule
12
{
13
    use HourlyIntervalRuleTrait;
14
    use RandSecondsRuleTrait;
15
16
    /**
17
     * @param int $start
18
     * @param int $end
19
     * @param int $seconds
20
     */
21 5
    public function __construct($start, $end, $seconds)
22
    {
23 5
        $this->setStart($start);
24 5
        $this->setEnd($end);
25 5
        $this->setSeconds($seconds);
26 5
    }
27
28
    /**
29
     * @param \DateTime $time
30
     *
31
     * @return bool
32
     */
33 5
    public function isMatched(\DateTime $time)
34
    {
35 5
        return $this->start() <= $time->format('G') && $this->end() > $time->format('G');
36
    }
37
}
38