Passed
Pull Request — master (#10)
by Robbie
01:27
created

AbstractFileCheck   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setFinder() 0 4 1
A getFinder() 0 6 2
1
<?php
2
3
namespace SilverStripe\ModuleRatings\Check;
4
5
use SilverStripe\ModuleRatings\Check;
6
use Symfony\Component\Finder\Finder;
7
8
/**
9
 * Provides a base class for checks that rely on filesystem checks to extend, giving access to a
10
 * Symfony finder component
11
 */
12
abstract class AbstractFileCheck extends Check
13
{
14
    /**
15
     * @var Finder
16
     */
17
    protected $finder;
18
19
    /**
20
     * Get the file finder component
21
     *
22
     * @return Finder
23
     */
24
    public function getFinder()
25
    {
26
        if (!$this->finder) {
27
            $this->finder = new Finder();
28
        }
29
        return $this->finder;
30
    }
31
32
    /**
33
     * Set the finder component to use
34
     *
35
     * @param Finder $finder
36
     * @return $this
37
     */
38
    public function setFinder(Finder $finder)
39
    {
40
        $this->finder = $finder;
41
        return $this;
42
    }
43
}
44