Passed
Push — master ( ea0ac9...54e0c4 )
by Robbie
01:44
created

src/Check/LicenseCheck.php (1 issue)

1
<?php
2
3
namespace SilverStripe\ModuleRatings\Check;
4
5
use SilverStripe\ModuleRatings\Check;
6
7 View Code Duplication
class LicenseCheck extends Check
0 ignored issues
show
This class seems to be duplicated in your project.

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.

Loading history...
8
{
9
    protected $points = 5;
10
11
    public function getKey()
12
    {
13
        return 'has_license';
14
    }
15
16
    public function getDescription()
17
    {
18
        return 'Has a license file';
19
    }
20
21
    public function run()
22
    {
23
        $options = ['license', 'LICENSE', 'license.md', 'LICENSE.md', 'license.txt', 'LICENSE.txt'];
24
        foreach ($options as $filename) {
25
            if (file_exists($this->getSuite()->getModuleRoot() . '/' . $filename)) {
26
                $this->setSuccessful(true);
27
                break;
28
            }
29
        }
30
    }
31
}
32