1 | <?php |
||
2 | |||
3 | namespace SilverStripe\ModuleRatings\Check; |
||
4 | |||
5 | View Code Duplication | class CodeCoverageGoodCheck extends AbstractCodeCoverageCheck |
|
0 ignored issues
–
show
|
|||
6 | { |
||
7 | protected $threshold = 40; |
||
8 | |||
9 | protected $points = 5; |
||
10 | |||
11 | public function getKey() |
||
12 | { |
||
13 | return 'good_code_coverage'; |
||
14 | } |
||
15 | |||
16 | public function getDescription() |
||
17 | { |
||
18 | return 'Has a "good" level of code coverage (greater than ' . $this->threshold . '%, requires slug)'; |
||
19 | } |
||
20 | |||
21 | public function run() |
||
22 | { |
||
23 | if ($this->getCoverage() >= $this->getThreshold()) { |
||
24 | $this->setSuccessful(true); |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.