Completed
Pull Request — master (#59)
by Bill
04:27
created

Config::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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