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

EverydayRule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 12
loc 12
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isMatched() 4 4 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 EverydayRule extends RandMaxSecondsRuleBase
11
{
12
    /**
13
     * @param \DateTime $time
14
     *
15
     * @return bool
16
     */
17 5
    public function isMatched(\DateTime $time)
18
    {
19 5
        return $this->getStart() <= $time->format('G') && $this->getEnd() > $time->format('G');
20
    }
21
}
22