Completed
Pull Request — master (#98)
by
unknown
03:42
created

Config::getFileExtensions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
3
namespace Churn\Values;
4
5
class Config
6
{
7
    /**
8
     * The number of files to display in the results table.
9
     * @var integer
10
     */
11
    private $filesToShow;
12
13
    /**
14
     * The minimum score a file need to display in the results table.
15
     * @var integer
16
     */
17
    private $minScoreToShow;
18
19
    /**
20
     * The number of parallel jobs to use to process the files.
21
     * @var integer
22
     */
23
    private $parallelJobs;
24
25
    /**
26
     * How far back in the git history to go to count commits.
27
     * @var string
28
     */
29
    private $commitsSince;
30
31
    /**
32
     * The paths to files to ignore when processing.
33
     * @var array
34
     */
35
    private $filesToIgnore;
36
37
    /**
38
     * The file extensions to use when processing.
39
     * @var array
40
     */
41
    private $fileExtensions;
42
43
    /**
44
     * Config constructor.
45
     * @param array $rawData Raw config data.
46
     */
47
    public function __construct(array $rawData = [])
48
    {
49
        $this->filesToShow = $rawData['filesToShow'] ?? 10;
50
        $this->minScoreToShow = $rawData['minScoreToShow'] ?? 0;
51
        $this->parallelJobs = $rawData['parallelJobs'] ?? 10;
52
        $this->commitsSince = $rawData['commitsSince'] ?? '10 years ago';
53
        $this->filesToIgnore = $rawData['filesToIgnore'] ?? [];
54
        $this->fileExtensions = $rawData['fileExtensions'] ?? ['php'];
55
    }
56
57
    /**
58
     * Get the number of files to display in the results table.
59
     * @return integer
60
     */
61
    public function getFilesToShow(): int
62
    {
63
        return $this->filesToShow;
64
    }
65
66
    /**
67
     * Get the minimum score a file need to display.
68
     * @return integer
69
     */
70
    public function getMinScoreToShow(): int
71
    {
72
        return $this->minScoreToShow;
73
    }
74
75
    /**
76
     * Get the number of parallel jobs to use to process the files.
77
     * @return integer
78
     */
79
    public function getParallelJobs(): int
80
    {
81
        return $this->parallelJobs;
82
    }
83
84
    /**
85
     * Get how far back in the git history to go to count commits.
86
     * @return string
87
     */
88
    public function getCommitsSince(): string
89
    {
90
        return $this->commitsSince;
91
    }
92
93
    /**
94
     * Get the paths to files to ignore when processing.
95
     * @return array
96
     */
97
    public function getFilesToIgnore(): array
98
    {
99
        return $this->filesToIgnore;
100
    }
101
102
    /**
103
     * Get the file extensions to use when processing.
104
     * @return array
105
     */
106
    public function getFileExtensions(): array
107
    {
108
        return $this->fileExtensions;
109
    }
110
}
111