Code Duplication    Length = 12-14 lines in 3 locations

src/Rule/EverydayRule.php 1 location

@@ 10-21 (lines=12) @@
7
 */
8
namespace AnimeDb\SmartSleep\Rule;
9
10
class EverydayRule extends RandMaxSecondsRuleBase
11
{
12
    /**
13
     * @param \DateTime $time
14
     *
15
     * @return bool
16
     */
17
    public function isMatched(\DateTime $time)
18
    {
19
        return $this->getStart() <= $time->format('G') && $this->getEnd() > $time->format('G');
20
    }
21
}
22

src/Rule/HolidayRule.php 1 location

@@ 10-23 (lines=14) @@
7
 */
8
namespace AnimeDb\SmartSleep\Rule;
9
10
class HolidayRule extends RandMaxSecondsRuleBase
11
{
12
    /**
13
     * @param \DateTime $time
14
     *
15
     * @return bool
16
     */
17
    public function isMatched(\DateTime $time)
18
    {
19
        return $time->format('N') > 5 &&
20
            $this->getStart() <= $time->format('G') &&
21
            $this->getEnd() > $time->format('G');
22
    }
23
}
24

src/Rule/WeekdayRule.php 1 location

@@ 10-23 (lines=14) @@
7
 */
8
namespace AnimeDb\SmartSleep\Rule;
9
10
class WeekdayRule extends RandMaxSecondsRuleBase
11
{
12
    /**
13
     * @param \DateTime $time
14
     *
15
     * @return bool
16
     */
17
    public function isMatched(\DateTime $time)
18
    {
19
        return $time->format('N') <= 5 &&
20
            $this->getStart() <= $time->format('G') &&
21
            $this->getEnd() > $time->format('G');
22
    }
23
}
24