| Conditions | 1 |
| Paths | 1 |
| Total Lines | 155 |
| Code Lines | 123 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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:
If many parameters/temporary variables are present:
| 1 | <?php declare(strict_types=1); |
||
| 191 | private function setTimeZone () { |
||
| 192 | |||
| 193 | $timezoneList = []; |
||
| 194 | $timezoneList['-12'] = [ |
||
| 195 | 'name' => 'Pacific/Kwajalein', |
||
| 196 | 'standard' => ['tzoffsetfrom' => '-1200', 'tzoffsetto' => '-1300'], |
||
| 197 | 'daylight' => ['tzoffsetfrom' => '-1300', 'tzoffsetto' => '-1200'] |
||
| 198 | ]; |
||
| 199 | $timezoneList['-11'] = [ |
||
| 200 | 'name' => 'Pacific/Pago_Pago', |
||
| 201 | 'standard' => ['tzoffsetfrom' => '-1100', 'tzoffsetto' => '-1200'], |
||
| 202 | 'daylight' => ['tzoffsetfrom' => '-1200', 'tzoffsetto' => '-1100'] |
||
| 203 | ]; |
||
| 204 | $timezoneList['-10'] = [ |
||
| 205 | 'name' => 'Pacific/Honolulu', |
||
| 206 | 'standard' => ['tzoffsetfrom' => '-1000', 'tzoffsetto' => '-1100'], |
||
| 207 | 'daylight' => ['tzoffsetfrom' => '-1100', 'tzoffsetto' => '-1000'] |
||
| 208 | ]; |
||
| 209 | $timezoneList['-9'] = [ |
||
| 210 | 'name' => 'America/Anchorage', |
||
| 211 | 'standard' => ['tzoffsetfrom' => '-0900', 'tzoffsetto' => '-1000'], |
||
| 212 | 'daylight' => ['tzoffsetfrom' => '-1000', 'tzoffsetto' => '-0900'] |
||
| 213 | ]; |
||
| 214 | $timezoneList['-8'] = [ |
||
| 215 | 'name' => 'America/Los_Angeles', |
||
| 216 | 'standard' => ['tzoffsetfrom' => '-0800', 'tzoffsetto' => '-0900'], |
||
| 217 | 'daylight' => ['tzoffsetfrom' => '-0900', 'tzoffsetto' => '-0800'] |
||
| 218 | ]; |
||
| 219 | $timezoneList['-7'] = [ |
||
| 220 | 'name' => 'America/Denver', |
||
| 221 | 'standard' => ['tzoffsetfrom' => '-0700', 'tzoffsetto' => '-0800'], |
||
| 222 | 'daylight' => ['tzoffsetfrom' => '-0800', 'tzoffsetto' => '-0700'] |
||
| 223 | ]; |
||
| 224 | $timezoneList['-6'] = [ |
||
| 225 | 'name' => 'America/Mexico_City', |
||
| 226 | 'standard' => ['tzoffsetfrom' => '-0600', 'tzoffsetto' => '-0700'], |
||
| 227 | 'daylight' => ['tzoffsetfrom' => '-0700', 'tzoffsetto' => '-0600'] |
||
| 228 | ]; |
||
| 229 | $timezoneList['-5'] = [ |
||
| 230 | 'name' => 'America/New_York', |
||
| 231 | 'standard' => ['tzoffsetfrom' => '-0500', 'tzoffsetto' => '-0600'], |
||
| 232 | 'daylight' => ['tzoffsetfrom' => '-0600', 'tzoffsetto' => '-0500'] |
||
| 233 | ]; |
||
| 234 | $timezoneList['-4'] = [ |
||
| 235 | 'name' => 'America/Caracas', |
||
| 236 | 'standard' => ['tzoffsetfrom' => '-0400', 'tzoffsetto' => '-0500'], |
||
| 237 | 'daylight' => ['tzoffsetfrom' => '-0500', 'tzoffsetto' => '-0400'] |
||
| 238 | ]; |
||
| 239 | $timezoneList['-3.5'] = [ |
||
| 240 | 'name' => 'America/St_Johns', |
||
| 241 | 'standard' => ['tzoffsetfrom' => '-0300', 'tzoffsetto' => '-0400'], |
||
| 242 | 'daylight' => ['tzoffsetfrom' => '-0400', 'tzoffsetto' => '-0300'] |
||
| 243 | ]; |
||
| 244 | $timezoneList['-3'] = [ |
||
| 245 | 'name' => 'America/Buenos_Aires', |
||
| 246 | 'standard' => ['tzoffsetfrom' => '-0200', 'tzoffsetto' => '-0300'], |
||
| 247 | 'daylight' => ['tzoffsetfrom' => '-0300', 'tzoffsetto' => '-0200'] |
||
| 248 | ]; |
||
| 249 | $timezoneList['-2'] = [ |
||
| 250 | 'name' => 'Atlantic/South_Georgia', |
||
| 251 | 'standard' => ['tzoffsetfrom' => '-0100', 'tzoffsetto' => '-0200'], |
||
| 252 | 'daylight' => ['tzoffsetfrom' => '-0200', 'tzoffsetto' => '-0100'] |
||
| 253 | ]; |
||
| 254 | $timezoneList['-1'] = [ |
||
| 255 | 'name' => 'Atlantic/Azores', |
||
| 256 | 'standard' => ['tzoffsetfrom' => '0000', 'tzoffsetto' => '-0100'], |
||
| 257 | 'daylight' => ['tzoffsetfrom' => '-0100', 'tzoffsetto' => '0000'] |
||
| 258 | ]; |
||
| 259 | $timezoneList['0'] = [ |
||
| 260 | 'name' => 'Europe/London', |
||
| 261 | 'standard' => ['tzoffsetfrom' => '+0100', 'tzoffsetto' => '0000'], |
||
| 262 | 'daylight' => ['tzoffsetfrom' => '0000', 'tzoffsetto' => '+0100'] |
||
| 263 | ]; |
||
| 264 | $timezoneList['1'] = [ |
||
| 265 | 'name' => 'Europe/Berlin', |
||
| 266 | 'standard' => ['tzoffsetfrom' => '+0200', 'tzoffsetto' => '+0100'], |
||
| 267 | 'daylight' => ['tzoffsetfrom' => '+0100', 'tzoffsetto' => '+0200']]; |
||
| 268 | $timezoneList['2'] = [ |
||
| 269 | 'name' => 'Europe/Athens', |
||
| 270 | 'standard' => ['tzoffsetfrom' => '+0300', 'tzoffsetto' => '+0200'], |
||
| 271 | 'daylight' => ['tzoffsetfrom' => '+0200', 'tzoffsetto' => '+0300'] |
||
| 272 | ]; |
||
| 273 | $timezoneList['3'] = [ |
||
| 274 | 'name' => 'Europe/Moscow', |
||
| 275 | 'standard' => ['tzoffsetfrom' => '+0400', 'tzoffsetto' => '+0300'], |
||
| 276 | 'daylight' => ['tzoffsetfrom' => '+0300', 'tzoffsetto' => '+0400'] |
||
| 277 | ]; |
||
| 278 | $timezoneList['3.5'] = [ |
||
| 279 | 'name' => 'Asia/Tehran', |
||
| 280 | 'standard' => ['tzoffsetfrom' => '+0450', 'tzoffsetto' => '+0350'], |
||
| 281 | 'daylight' => ['tzoffsetfrom' => '+0350', 'tzoffsetto' => '+0450'] |
||
| 282 | ]; |
||
| 283 | $timezoneList['4'] = [ |
||
| 284 | 'name' => 'Asia/Baku', |
||
| 285 | 'standard' => ['tzoffsetfrom' => '+0500', 'tzoffsetto' => '+0400'], |
||
| 286 | 'daylight' => ['tzoffsetfrom' => '+0400', 'tzoffsetto' => '+0500'] |
||
| 287 | ]; |
||
| 288 | $timezoneList['4.5'] = [ |
||
| 289 | 'name' => 'Asia/Kabul', |
||
| 290 | 'standard' => ['tzoffsetfrom' => '+0550', 'tzoffsetto' => '+0450'], |
||
| 291 | 'daylight' => ['tzoffsetfrom' => '+0450', 'tzoffsetto' => '+0550'] |
||
| 292 | ]; |
||
| 293 | $timezoneList['5'] = [ |
||
| 294 | 'name' => 'Asia/Tashkent', |
||
| 295 | 'standard' => ['tzoffsetfrom' => '+0600', 'tzoffsetto' => '+0500'], |
||
| 296 | 'daylight' => ['tzoffsetfrom' => '+0500', 'tzoffsetto' => '+0600'] |
||
| 297 | ]; |
||
| 298 | $timezoneList['5.5'] = [ |
||
| 299 | 'name' => 'Asia/Calcutta', |
||
| 300 | 'standard' => ['tzoffsetfrom' => '+0700', 'tzoffsetto' => '+0600'], |
||
| 301 | 'daylight' => ['tzoffsetfrom' => '+0600', 'tzoffsetto' => '+0700'] |
||
| 302 | ]; |
||
| 303 | $timezoneList['6'] = [ |
||
| 304 | 'name' => 'Asia/Dhaka', |
||
| 305 | 'standard' => ['tzoffsetfrom' => '+0750', 'tzoffsetto' => '+0650'], |
||
| 306 | 'daylight' => ['tzoffsetfrom' => '+0650', 'tzoffsetto' => '+0750'] |
||
| 307 | ]; |
||
| 308 | $timezoneList['7'] = [ |
||
| 309 | 'name' => 'Asia/Bangkok', |
||
| 310 | 'standard' => ['tzoffsetfrom' => '+0800', 'tzoffsetto' => '+0700'], |
||
| 311 | 'daylight' => ['tzoffsetfrom' => '+0700', 'tzoffsetto' => '+0800'] |
||
| 312 | ]; |
||
| 313 | $timezoneList['8'] = [ |
||
| 314 | 'name' => 'Asia/Singapore', |
||
| 315 | 'standard' => ['tzoffsetfrom' => '+0900', 'tzoffsetto' => '+0800'], |
||
| 316 | 'daylight' => ['tzoffsetfrom' => '+0800', 'tzoffsetto' => '+0900'] |
||
| 317 | ]; |
||
| 318 | $timezoneList['9'] = [ |
||
| 319 | 'name' => 'Asia/Tokyo', |
||
| 320 | 'standard' => ['tzoffsetfrom' => '+1000', 'tzoffsetto' => '+0900'], |
||
| 321 | 'daylight' => ['tzoffsetfrom' => '+0900', 'tzoffsetto' => '+1000'] |
||
| 322 | ]; |
||
| 323 | $timezoneList['9.5'] = [ |
||
| 324 | 'name' => 'Australia/Adelaide', |
||
| 325 | 'standard' => ['tzoffsetfrom' => '+1050', 'tzoffsetto' => '+0950'], |
||
| 326 | 'daylight' => ['tzoffsetfrom' => '+0950', 'tzoffsetto' => '+1050'] |
||
| 327 | ]; |
||
| 328 | $timezoneList['10'] = [ |
||
| 329 | 'name' => 'Australia/Sydney Australia/Melbourne', |
||
| 330 | 'standard' => ['tzoffsetfrom' => '+1100', 'tzoffsetto' => '+1000'], |
||
| 331 | 'daylight' => ['tzoffsetfrom' => '+1000', 'tzoffsetto' => '+1100'] |
||
| 332 | ]; |
||
| 333 | $timezoneList['11'] = [ |
||
| 334 | 'name' => 'Asia/Magadan', |
||
| 335 | 'standard' => ['tzoffsetfrom' => '+1200', 'tzoffsetto' => '+1100'], |
||
| 336 | 'daylight' => ['tzoffsetfrom' => '+1100', 'tzoffsetto' => '+1200'] |
||
| 337 | ]; |
||
| 338 | $timezoneList['12'] = [ |
||
| 339 | 'name' => 'Pacific/Fiji', |
||
| 340 | 'standard' => ['tzoffsetfrom' => '+1300', 'tzoffsetto' => '+1200'], |
||
| 341 | 'daylight' => ['tzoffsetfrom' => '+1200', 'tzoffsetto' => '+1300'] |
||
| 342 | ]; |
||
| 343 | |||
| 344 | $this->timezone = $timezoneList[$GLOBALS['xoopsConfig']['server_TZ']]; |
||
| 345 | return true; |
||
| 346 | |||
| 372 |