HitDto::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 65
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 32
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 31
nc 1
nop 31
dl 0
loc 65
ccs 32
cts 32
cp 1
crap 1
rs 9.424
c 0
b 0
f 0

How to fix   Long Method    Many Parameters   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
namespace coderius\hitCounter\dto;
4
5
final class HitDto
6
{
7
    private $counter_id;
8
    private $cookie_mark;
9
    private $js_cookei_enabled;
10
    private $js_java_enabled;
11
    private $js_timezone_offset;
12
    private $js_timezone;
13
    private $js_connection;
14
    private $js_current_url;
15
    private $js_referer_url;
16
    private $js_screen_width;
17
    private $js_screen_height;
18
    private $js_color_depth;
19
    private $js_browser_language;
20
    private $js_history_length;
21
    private $js_is_toutch_device;
22
    private $js_processor_ram;
23
    private $serv_ip;
24
    private $serv_user_agent;
25
    private $serv_referer_url;
26
    private $serv_server_name;
27
    private $serv_auth_user_id;
28
    private $serv_port;
29
    private $serv_cookies;
30
    private $serv_os;
31
    private $serv_client;
32
    private $serv_device;
33
    private $serv_brand;
34
    private $serv_model;
35
    private $serv_bot;
36
    private $serv_host_by_ip;
37
    private $serv_is_proxy_or_vpn;
38
39 3
    public function __construct(
40
        $counter_id,
41
        $cookie_mark,
42
        $js_cookei_enabled,
43
        $js_java_enabled,
44
        $js_timezone_offset,
45
        $js_timezone,
46
        $js_connection,
47
        $js_current_url,
48
        $js_referer_url,
49
        $js_screen_width,
50
        $js_screen_height,
51
        $js_color_depth,
52
        $js_browser_language,
53
        $js_history_length,
54
        $js_is_toutch_device,
55
        $js_processor_ram,
56
        $serv_ip,
57
        $serv_user_agent,
58
        $serv_referer_url,
59
        $serv_server_name,
60
        $serv_auth_user_id,
61
        $serv_port,
62
        $serv_cookies,
63
        $serv_os,
64
        $serv_client,
65
        $serv_device,
66
        $serv_brand,
67
        $serv_model,
68
        $serv_bot,
69
        $serv_host_by_ip,
70
        $serv_is_proxy_or_vpn
71
    )
72
    {
73 3
        $this->counter_id = $counter_id;
74 3
        $this->cookie_mark = $cookie_mark;
75 3
        $this->js_cookei_enabled = $js_cookei_enabled;
76 3
        $this->js_java_enabled = $js_java_enabled;
77 3
        $this->js_timezone_offset = $js_timezone_offset;
78 3
        $this->js_timezone = $js_timezone;
79 3
        $this->js_connection = $js_connection;
80 3
        $this->js_current_url = $js_current_url;
81 3
        $this->js_referer_url = $js_referer_url;
82 3
        $this->js_screen_width = $js_screen_width;
83 3
        $this->js_screen_height = $js_screen_height;
84 3
        $this->js_color_depth = $js_color_depth;
85 3
        $this->js_browser_language = $js_browser_language;
86 3
        $this->js_history_length = $js_history_length;
87 3
        $this->js_is_toutch_device = $js_is_toutch_device;
88 3
        $this->js_processor_ram = $js_processor_ram;
89 3
        $this->serv_ip = $serv_ip;
90 3
        $this->serv_user_agent = $serv_user_agent;
91 3
        $this->serv_referer_url = $serv_referer_url;
92 3
        $this->serv_server_name = $serv_server_name;
93 3
        $this->serv_auth_user_id = $serv_auth_user_id;
94 3
        $this->serv_port = $serv_port;
95 3
        $this->serv_cookies = $serv_cookies;
96 3
        $this->serv_os = $serv_os;
97 3
        $this->serv_client = $serv_client;
98 3
        $this->serv_device = $serv_device;
99 3
        $this->serv_brand = $serv_brand;
100 3
        $this->serv_model = $serv_model;
101 3
        $this->serv_bot = $serv_bot;
102 3
        $this->serv_host_by_ip = $serv_host_by_ip;
103 3
        $this->serv_is_proxy_or_vpn = $serv_is_proxy_or_vpn;
104 3
    }
105
106
107
    /**
108
     * Get the value of counter_id
109
     */ 
110 3
    public function getCounterId()
111
    {
112 3
        return $this->counter_id;
113
    }
114
115
    /**
116
     * Get the value of cookie_mark
117
     */ 
118 3
    public function getCookieMark()
119
    {
120 3
        return $this->cookie_mark;
121
    }
122
123
    /**
124
     * Get the value of js_cookei_enabled
125
     */ 
126 3
    public function getJsCookeiEnabled()
127
    {
128 3
        return $this->js_cookei_enabled;
129
    }
130
131
    /**
132
     * Get the value of js_java_enabled
133
     */ 
134 3
    public function getJsJavaEnabled()
135
    {
136 3
        return $this->js_java_enabled;
137
    }
138
139
    /**
140
     * Get the value of js_timezone_offset
141
     */ 
142 3
    public function getJsTimezoneOffset()
143
    {
144 3
        return $this->js_timezone_offset;
145
    }
146
147
    /**
148
     * Get the value of js_timezone
149
     */ 
150 3
    public function getJsTimezone()
151
    {
152 3
        return $this->js_timezone;
153
    }
154
155
    
156
157
    /**
158
     * Get the value of js_current_url
159
     */ 
160 3
    public function getJsCurrentUrl()
161
    {
162 3
        return $this->js_current_url;
163
    }
164
165
    /**
166
     * Get the value of js_referer_url
167
     */ 
168 3
    public function getJsRefererUrl()
169
    {
170 3
        return $this->js_referer_url;
171
    }
172
173
    /**
174
     * Get the value of js_screen_width
175
     */ 
176 3
    public function getJsScreenWidth()
177
    {
178 3
        return $this->js_screen_width;
179
    }
180
181
    /**
182
     * Get the value of js_screen_height
183
     */ 
184 3
    public function getJsScreenHeight()
185
    {
186 3
        return $this->js_screen_height;
187
    }
188
189
    /**
190
     * Get the value of js_color_depth
191
     */ 
192 3
    public function getJsColorDepth()
193
    {
194 3
        return $this->js_color_depth;
195
    }
196
197
    /**
198
     * Get the value of js_browser_language
199
     */ 
200 3
    public function getJsBrowserLanguage()
201
    {
202 3
        return $this->js_browser_language;
203
    }
204
205
    /**
206
     * Get the value of js_history_length
207
     */ 
208 3
    public function getJsHistoryLength()
209
    {
210 3
        return $this->js_history_length;
211
    }
212
213
    /**
214
     * Get the value of js_is_toutch_device
215
     */ 
216 3
    public function getJsIsToutchDevice()
217
    {
218 3
        return $this->js_is_toutch_device;
219
    }
220
221
    /**
222
     * Get the value of js_processor_ram
223
     */ 
224 3
    public function getJsProcessorRam()
225
    {
226 3
        return $this->js_processor_ram;
227
    }
228
229
    /**
230
     * Get the value of serv_ip
231
     */ 
232 3
    public function getServIp()
233
    {
234 3
        return $this->serv_ip;
235
    }
236
237
    /**
238
     * Get the value of serv_user_agent
239
     */ 
240 3
    public function getServUserAgent()
241
    {
242 3
        return $this->serv_user_agent;
243
    }
244
245
    /**
246
     * Get the value of serv_referer_url
247
     */ 
248 3
    public function getServRefererUrl()
249
    {
250 3
        return $this->serv_referer_url;
251
    }
252
253
    /**
254
     * Get the value of serv_server_name
255
     */ 
256 3
    public function getServServerName()
257
    {
258 3
        return $this->serv_server_name;
259
    }
260
261
    /**
262
     * Get the value of serv_auth_user_id
263
     */ 
264 3
    public function getServAuthUserId()
265
    {
266 3
        return $this->serv_auth_user_id;
267
    }
268
269
        /**
270
         * Get the value of serv_port
271
         */ 
272 3
        public function getServPort()
273
        {
274 3
                return $this->serv_port;
275
        }
276
277
    /**
278
     * Get the value of serv_cookies
279
     */ 
280 3
    public function getServCookies()
281
    {
282 3
        return $this->serv_cookies;
283
    }
284
285
    /**
286
     * Get the value of serv_os
287
     */ 
288 3
    public function getServOs()
289
    {
290 3
        return $this->serv_os;
291
    }
292
293
    /**
294
     * Get the value of serv_client
295
     */ 
296 3
    public function getServClient()
297
    {
298 3
        return $this->serv_client;
299
    }
300
301
    /**
302
     * Get the value of serv_device
303
     */ 
304 3
    public function getServDevice()
305
    {
306 3
        return $this->serv_device;
307
    }
308
309
    /**
310
     * Get the value of serv_brand
311
     */ 
312 3
    public function getServBrand()
313
    {
314 3
        return $this->serv_brand;
315
    }
316
317
    /**
318
     * Get the value of serv_model
319
     */ 
320 3
    public function getServModel()
321
    {
322 3
        return $this->serv_model;
323
    }
324
325
    /**
326
     * Get the value of serv_bot
327
     */ 
328 3
    public function getServBot()
329
    {
330 3
        return $this->serv_bot;
331
    }
332
333
    /**
334
     * Get the value of serv_host_by_ip
335
     */ 
336 3
    public function getServHostByIp()
337
    {
338 3
        return $this->serv_host_by_ip;
339
    }
340
341
    /**
342
     * Get the value of serv_is_proxy_or_vpn
343
     */ 
344 3
    public function getServIsProxyOrVpn()
345
    {
346 3
        return $this->serv_is_proxy_or_vpn;
347
    }
348
349
    /**
350
     * Get the value of js_connection
351
     */ 
352 3
    public function getJsConnection()
353
    {
354 3
        return $this->js_connection;
355
    }
356
}