Completed
Push — master ( 0ebeda...45d090 )
by Peter
02:31
created

WeekdayRule::isMatched()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 6
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 3
eloc 4
nc 3
nop 1
crap 3
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 */
8
namespace AnimeDb\SmartSleep\Rule;
9
10 View Code Duplication
class WeekdayRule extends RandMaxSecondsRuleBase
11
{
12
    /**
13
     * @param \DateTime $time
14
     *
15
     * @return bool
16
     */
17 11
    public function isMatched(\DateTime $time)
18
    {
19 11
        return $time->format('N') <= 5 &&
20 11
            $this->getStart() <= $time->format('G') &&
21 11
            $this->getEnd() > $time->format('G');
22
    }
23
}
24