Completed
Push — master ( 9003e7...f2c4d3 )
by ReliQ
04:59
created

TemplateConfig::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliQArts\Docweaver\Models;
6
7
class TemplateConfig
8
{
9
    /**
10
     * @var string
11
     */
12
    private $masterTemplate;
13
14
    /**
15
     * @var string
16
     */
17
    private $masterSection;
18
19
    /**
20
     * @var string
21
     */
22
    private $styleStack;
23
24
    /**
25
     * @var string
26
     */
27
    private $scriptStack;
28
29
    /**
30
     * @var string
31
     */
32
    private $indexTitle;
33
34
    /**
35
     * @var string
36
     */
37
    private $indexIntro;
38
39
    /**
40
     * @var bool
41
     */
42
    private $showProductLine;
43
44
    /**
45
     * @var bool
46
     */
47
    private $showFootnotes;
48
49
    /**
50
     * TemplateConfig constructor.
51
     *
52
     * @param string $masterTemplate
53
     * @param string $masterSection
54
     * @param string $styleStack
55
     * @param string $scriptStack
56
     * @param string $indexTitle
57
     * @param string $indexIntro
58
     * @param bool   $showProductLine
59
     * @param bool   $showFootnotes
60
     */
61
    public function __construct(
62
        string $masterTemplate,
63
        string $masterSection,
64
        string $styleStack,
65
        string $scriptStack,
66
        string $indexTitle,
67
        string $indexIntro,
68
        bool $showProductLine = true,
69
        bool $showFootnotes = true
70
    ) {
71
        $this->masterTemplate = $masterTemplate;
72
        $this->masterSection = $masterSection;
73
        $this->styleStack = $styleStack;
74
        $this->scriptStack = $scriptStack;
75
        $this->indexTitle = $indexTitle;
76
        $this->indexIntro = $indexIntro;
77
        $this->showProductLine = $showProductLine;
78
        $this->showFootnotes = $showFootnotes;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function getMasterTemplate(): string
85
    {
86
        return $this->masterTemplate;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getMasterSection(): string
93
    {
94
        return $this->masterSection;
95
    }
96
97
    /**
98
     * @return string
99
     */
100
    public function getStyleStack(): string
101
    {
102
        return $this->styleStack;
103
    }
104
105
    /**
106
     * @return bool
107
     */
108
    public function hasStyleStack(): bool
109
    {
110
        return !empty($this->getStyleStack());
111
    }
112
113
    /**
114
     * @return string
115
     */
116
    public function getScriptStack(): string
117
    {
118
        return $this->scriptStack;
119
    }
120
121
    /**
122
     * @return bool
123
     */
124
    public function hasScriptStack(): bool
125
    {
126
        return !empty($this->getScriptStack());
127
    }
128
129
    /**
130
     * @return string
131
     */
132
    public function getIndexTitle(): string
133
    {
134
        return $this->indexTitle;
135
    }
136
137
    /**
138
     * @return string
139
     */
140
    public function getIndexIntro(): string
141
    {
142
        return $this->indexIntro;
143
    }
144
145
    /**
146
     * @return bool
147
     */
148
    public function isShowProductLine(): bool
149
    {
150
        return $this->showProductLine;
151
    }
152
153
    /**
154
     * @return bool
155
     */
156
    public function isShowFootnotes(): bool
157
    {
158
        return $this->showFootnotes;
159
    }
160
}
161