EverydayRule::isMatched()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 2
eloc 2
nc 2
nop 1
crap 2
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 \DateTimeImmutable $time
30
     *
31
     * @return bool
32
     */
33 5
    public function isMatched(\DateTimeImmutable $time)
34
    {
35 5
        return $this->start() <= $time->format('G') && $this->end() > $time->format('G');
36
    }
37
}
38