| Total Complexity | 50 |
| Total Lines | 627 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Complex classes like AbstractRequestContainer often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AbstractRequestContainer, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 10 | abstract class AbstractRequestContainer extends AbstractContainer |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string|null merchant id |
||
| 14 | */ |
||
| 15 | protected $mid; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string|null |
||
| 19 | */ |
||
| 20 | protected $aid; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string|null payment portal id |
||
| 24 | */ |
||
| 25 | protected $portalid; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string payment portal id as md5 |
||
| 29 | */ |
||
| 30 | protected $key; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var string|null version of the the payone api defaults to 3.8 |
||
| 34 | */ |
||
| 35 | protected $api_version; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var string|null test or live mode |
||
| 39 | */ |
||
| 40 | protected $mode; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var string payone query name (e.g. preauthorization, authorization...) |
||
| 44 | */ |
||
| 45 | protected $request; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var string|null encoding (ISO 8859-1 or UTF-8) |
||
| 49 | */ |
||
| 50 | protected $encoding; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * name of the solution-partner (company) |
||
| 54 | * |
||
| 55 | * @var string |
||
| 56 | */ |
||
| 57 | protected $solution_name; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * version of the solution-partner's app / extension / plugin / etc.. |
||
| 61 | * |
||
| 62 | * @var string |
||
| 63 | */ |
||
| 64 | protected $solution_version; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * system-name |
||
| 68 | * |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | protected $integrator_name; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * system-version |
||
| 75 | * |
||
| 76 | * @var string |
||
| 77 | */ |
||
| 78 | protected $integrator_version; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @var string|null |
||
| 82 | */ |
||
| 83 | protected $language; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @var string |
||
| 87 | */ |
||
| 88 | protected $hash; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @var string|null |
||
| 92 | */ |
||
| 93 | protected $responsetype; |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @var array |
||
| 97 | */ |
||
| 98 | protected $it; |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @var array |
||
| 102 | */ |
||
| 103 | protected $id; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @var array |
||
| 107 | */ |
||
| 108 | protected $pr; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @var array |
||
| 112 | */ |
||
| 113 | protected $no; |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @var array |
||
| 117 | */ |
||
| 118 | protected $de; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @var array |
||
| 122 | */ |
||
| 123 | protected $va; |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @var string |
||
| 127 | */ |
||
| 128 | protected $email; |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @var string|null |
||
| 132 | */ |
||
| 133 | protected $backurl; |
||
| 134 | |||
| 135 | /** |
||
| 136 | * @var string|null |
||
| 137 | */ |
||
| 138 | protected $successurl; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @var string|null |
||
| 142 | */ |
||
| 143 | protected $errorurl; |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @param string|null $encoding |
||
| 147 | * |
||
| 148 | * @return $this |
||
| 149 | */ |
||
| 150 | public function setEncoding(?string $encoding) |
||
| 151 | { |
||
| 152 | $this->encoding = $encoding; |
||
| 153 | |||
| 154 | return $this; |
||
| 155 | } |
||
| 156 | |||
| 157 | /** |
||
| 158 | * @return string|null |
||
| 159 | */ |
||
| 160 | public function getEncoding(): ?string |
||
| 161 | { |
||
| 162 | return $this->encoding; |
||
| 163 | } |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @param string $key |
||
| 167 | * |
||
| 168 | * @return $this |
||
| 169 | */ |
||
| 170 | public function setKey(string $key) |
||
| 171 | { |
||
| 172 | $this->key = $key; |
||
| 173 | |||
| 174 | return $this; |
||
| 175 | } |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @return string |
||
| 179 | */ |
||
| 180 | public function getKey(): string |
||
| 181 | { |
||
| 182 | return $this->key; |
||
| 183 | } |
||
| 184 | |||
| 185 | /** |
||
| 186 | * @param string|null $api_version |
||
| 187 | * |
||
| 188 | * @return $this |
||
| 189 | */ |
||
| 190 | public function setApiVersion(?string $api_version) |
||
| 191 | { |
||
| 192 | $this->api_version = $api_version; |
||
| 193 | |||
| 194 | return $this; |
||
| 195 | } |
||
| 196 | |||
| 197 | /** |
||
| 198 | * @return string|null |
||
| 199 | */ |
||
| 200 | public function getApiVersion(): ?string |
||
| 201 | { |
||
| 202 | return $this->api_version; |
||
| 203 | } |
||
| 204 | |||
| 205 | /** |
||
| 206 | * @param string|null $mid |
||
| 207 | * |
||
| 208 | * @return $this |
||
| 209 | */ |
||
| 210 | public function setMid(?string $mid) |
||
| 211 | { |
||
| 212 | $this->mid = $mid; |
||
| 213 | |||
| 214 | return $this; |
||
| 215 | } |
||
| 216 | |||
| 217 | /** |
||
| 218 | * @return string|null |
||
| 219 | */ |
||
| 220 | public function getMid(): ?string |
||
| 221 | { |
||
| 222 | return $this->mid; |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
| 226 | * @param string $mode |
||
| 227 | * |
||
| 228 | * @return $this |
||
| 229 | */ |
||
| 230 | public function setMode(string $mode) |
||
| 231 | { |
||
| 232 | $this->mode = $mode; |
||
| 233 | |||
| 234 | return $this; |
||
| 235 | } |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @return string|null |
||
| 239 | */ |
||
| 240 | public function getMode(): ?string |
||
| 241 | { |
||
| 242 | return $this->mode; |
||
| 243 | } |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param string|null $portalid |
||
| 247 | * |
||
| 248 | * @return $this |
||
| 249 | */ |
||
| 250 | public function setPortalid(?string $portalid) |
||
| 251 | { |
||
| 252 | $this->portalid = $portalid; |
||
| 253 | |||
| 254 | return $this; |
||
| 255 | } |
||
| 256 | |||
| 257 | /** |
||
| 258 | * @return string|null |
||
| 259 | */ |
||
| 260 | public function getPortalid(): ?string |
||
| 261 | { |
||
| 262 | return $this->portalid; |
||
| 263 | } |
||
| 264 | |||
| 265 | /** |
||
| 266 | * @param string $request |
||
| 267 | * |
||
| 268 | * @return $this |
||
| 269 | */ |
||
| 270 | public function setRequest(string $request) |
||
| 271 | { |
||
| 272 | $this->request = $request; |
||
| 273 | |||
| 274 | return $this; |
||
| 275 | } |
||
| 276 | |||
| 277 | /** |
||
| 278 | * @return string |
||
| 279 | */ |
||
| 280 | public function getRequest(): string |
||
| 281 | { |
||
| 282 | return $this->request; |
||
| 283 | } |
||
| 284 | |||
| 285 | /** |
||
| 286 | * set the system-Name |
||
| 287 | * |
||
| 288 | * @param string $integratorName |
||
| 289 | * |
||
| 290 | * @return $this |
||
| 291 | */ |
||
| 292 | public function setIntegratorName(string $integratorName) |
||
| 293 | { |
||
| 294 | $this->integrator_name = $integratorName; |
||
| 295 | |||
| 296 | return $this; |
||
| 297 | } |
||
| 298 | |||
| 299 | /** |
||
| 300 | * @return string |
||
| 301 | */ |
||
| 302 | public function getIntegratorName(): string |
||
| 303 | { |
||
| 304 | return $this->integrator_name; |
||
| 305 | } |
||
| 306 | |||
| 307 | /** |
||
| 308 | * set the system-version |
||
| 309 | * |
||
| 310 | * @param string $integrator_version |
||
| 311 | * |
||
| 312 | * @return $this |
||
| 313 | */ |
||
| 314 | public function setIntegratorVersion(string $integrator_version) |
||
| 315 | { |
||
| 316 | $this->integrator_version = $integrator_version; |
||
| 317 | |||
| 318 | return $this; |
||
| 319 | } |
||
| 320 | |||
| 321 | /** |
||
| 322 | * @return string |
||
| 323 | */ |
||
| 324 | public function getIntegratorVersion(): string |
||
| 325 | { |
||
| 326 | return $this->integrator_version; |
||
| 327 | } |
||
| 328 | |||
| 329 | /** |
||
| 330 | * set the name of the solution-partner (company) |
||
| 331 | * |
||
| 332 | * @param string $solution_name |
||
| 333 | * |
||
| 334 | * @return $this |
||
| 335 | */ |
||
| 336 | public function setSolutionName(string $solution_name) |
||
| 337 | { |
||
| 338 | $this->solution_name = $solution_name; |
||
| 339 | |||
| 340 | return $this; |
||
| 341 | } |
||
| 342 | |||
| 343 | /** |
||
| 344 | * @return string |
||
| 345 | */ |
||
| 346 | public function getSolutionName(): string |
||
| 347 | { |
||
| 348 | return $this->solution_name; |
||
| 349 | } |
||
| 350 | |||
| 351 | /** |
||
| 352 | * set the version of the solution-partner's app / extension / plugin / etc.. |
||
| 353 | * |
||
| 354 | * @param string $solution_version |
||
| 355 | * |
||
| 356 | * @return $this |
||
| 357 | */ |
||
| 358 | public function setSolutionVersion(string $solution_version) |
||
| 359 | { |
||
| 360 | $this->solution_version = $solution_version; |
||
| 361 | |||
| 362 | return $this; |
||
| 363 | } |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @return string |
||
| 367 | */ |
||
| 368 | public function getSolutionVersion(): string |
||
| 369 | { |
||
| 370 | return $this->solution_version; |
||
| 371 | } |
||
| 372 | |||
| 373 | /** |
||
| 374 | * @return string|null |
||
| 375 | */ |
||
| 376 | public function getAid(): ?string |
||
| 377 | { |
||
| 378 | return $this->aid; |
||
| 379 | } |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @param string|null $aid |
||
| 383 | * |
||
| 384 | * @return $this |
||
| 385 | */ |
||
| 386 | public function setAid(?string $aid) |
||
| 387 | { |
||
| 388 | $this->aid = $aid; |
||
| 389 | |||
| 390 | return $this; |
||
| 391 | } |
||
| 392 | |||
| 393 | /** |
||
| 394 | * @return string|null |
||
| 395 | */ |
||
| 396 | public function getLanguage(): ?string |
||
| 397 | { |
||
| 398 | return $this->language; |
||
| 399 | } |
||
| 400 | |||
| 401 | /** |
||
| 402 | * @param string|null $language |
||
| 403 | * |
||
| 404 | * @return $this |
||
| 405 | */ |
||
| 406 | public function setLanguage(?string $language) |
||
| 407 | { |
||
| 408 | $this->language = $language; |
||
| 409 | |||
| 410 | return $this; |
||
| 411 | } |
||
| 412 | |||
| 413 | /** |
||
| 414 | * @param string $hash |
||
| 415 | * |
||
| 416 | * @return $this |
||
| 417 | */ |
||
| 418 | public function setHash(string $hash) |
||
| 419 | { |
||
| 420 | $this->hash = $hash; |
||
| 421 | |||
| 422 | return $this; |
||
| 423 | } |
||
| 424 | |||
| 425 | /** |
||
| 426 | * @return string |
||
| 427 | */ |
||
| 428 | public function getHash(): string |
||
| 429 | { |
||
| 430 | return $this->hash; |
||
| 431 | } |
||
| 432 | |||
| 433 | /** |
||
| 434 | * @return string|null |
||
| 435 | */ |
||
| 436 | public function getResponsetype(): ?string |
||
| 437 | { |
||
| 438 | return $this->responsetype; |
||
| 439 | } |
||
| 440 | |||
| 441 | /** |
||
| 442 | * @param string|null $responsetype |
||
| 443 | * |
||
| 444 | * @return $this |
||
| 445 | */ |
||
| 446 | public function setResponsetype(?string $responsetype) |
||
| 447 | { |
||
| 448 | $this->responsetype = $responsetype; |
||
| 449 | |||
| 450 | return $this; |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return array |
||
| 455 | */ |
||
| 456 | public function getIt(): array |
||
| 457 | { |
||
| 458 | return $this->it; |
||
| 459 | } |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @param array $it |
||
| 463 | * |
||
| 464 | * @return void |
||
| 465 | */ |
||
| 466 | public function setIt(array $it): void |
||
| 467 | { |
||
| 468 | $this->it = $it; |
||
| 469 | } |
||
| 470 | |||
| 471 | /** |
||
| 472 | * @return array |
||
| 473 | */ |
||
| 474 | public function getId(): array |
||
| 475 | { |
||
| 476 | return $this->id; |
||
| 477 | } |
||
| 478 | |||
| 479 | /** |
||
| 480 | * @param array $id |
||
| 481 | * |
||
| 482 | * @return void |
||
| 483 | */ |
||
| 484 | public function setId(array $id): void |
||
| 485 | { |
||
| 486 | $this->id = $id; |
||
| 487 | } |
||
| 488 | |||
| 489 | /** |
||
| 490 | * @return array |
||
| 491 | */ |
||
| 492 | public function getPr(): array |
||
| 493 | { |
||
| 494 | return $this->pr; |
||
| 495 | } |
||
| 496 | |||
| 497 | /** |
||
| 498 | * @param array $pr |
||
| 499 | * |
||
| 500 | * @return void |
||
| 501 | */ |
||
| 502 | public function setPr(array $pr): void |
||
| 503 | { |
||
| 504 | $this->pr = $pr; |
||
| 505 | } |
||
| 506 | |||
| 507 | /** |
||
| 508 | * @return array |
||
| 509 | */ |
||
| 510 | public function getNo(): array |
||
| 511 | { |
||
| 512 | return $this->no; |
||
| 513 | } |
||
| 514 | |||
| 515 | /** |
||
| 516 | * @param array $no |
||
| 517 | * |
||
| 518 | * @return void |
||
| 519 | */ |
||
| 520 | public function setNo(array $no): void |
||
| 521 | { |
||
| 522 | $this->no = $no; |
||
| 523 | } |
||
| 524 | |||
| 525 | /** |
||
| 526 | * @return array |
||
| 527 | */ |
||
| 528 | public function getDe(): array |
||
| 529 | { |
||
| 530 | return $this->de; |
||
| 531 | } |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @param array $de |
||
| 535 | * |
||
| 536 | * @return void |
||
| 537 | */ |
||
| 538 | public function setDe(array $de): void |
||
| 539 | { |
||
| 540 | $this->de = $de; |
||
| 541 | } |
||
| 542 | |||
| 543 | /** |
||
| 544 | * @return array |
||
| 545 | */ |
||
| 546 | public function getVa(): array |
||
| 547 | { |
||
| 548 | return $this->va; |
||
| 549 | } |
||
| 550 | |||
| 551 | /** |
||
| 552 | * @param array $va |
||
| 553 | * |
||
| 554 | * @return void |
||
| 555 | */ |
||
| 556 | public function setVa(array $va): void |
||
| 557 | { |
||
| 558 | $this->va = $va; |
||
| 559 | } |
||
| 560 | |||
| 561 | /** |
||
| 562 | * @return string |
||
| 563 | */ |
||
| 564 | public function getEmail(): string |
||
| 565 | { |
||
| 566 | return $this->email; |
||
| 567 | } |
||
| 568 | |||
| 569 | /** |
||
| 570 | * @param string $email |
||
| 571 | * |
||
| 572 | * @return void |
||
| 573 | */ |
||
| 574 | public function setEmail(string $email): void |
||
| 577 | } |
||
| 578 | |||
| 579 | /** |
||
| 580 | * @return string |
||
| 581 | */ |
||
| 582 | public function getBackUrl(): string |
||
| 585 | } |
||
| 586 | |||
| 587 | /** |
||
| 588 | * @param string|null $backUrl |
||
| 589 | * |
||
| 590 | * @return $this |
||
| 591 | */ |
||
| 592 | public function setBackUrl(?string $backUrl) |
||
| 593 | { |
||
| 594 | $this->backurl = $backUrl; |
||
| 595 | |||
| 596 | return $this; |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * @return string |
||
| 601 | */ |
||
| 602 | public function getSuccessUrl(): string |
||
| 603 | { |
||
| 604 | return $this->successurl; |
||
| 605 | } |
||
| 606 | |||
| 607 | /** |
||
| 608 | * @param string|null $successUrl |
||
| 609 | * |
||
| 610 | * @return $this |
||
| 611 | */ |
||
| 612 | public function setSuccessUrl(?string $successUrl) |
||
| 613 | { |
||
| 614 | $this->successurl = $successUrl; |
||
| 615 | |||
| 616 | return $this; |
||
| 617 | } |
||
| 618 | |||
| 619 | /** |
||
| 620 | * @return string |
||
| 621 | */ |
||
| 622 | public function getErrorUrl(): string |
||
| 623 | { |
||
| 624 | return $this->errorurl; |
||
| 625 | } |
||
| 626 | |||
| 627 | /** |
||
| 628 | * @param string|null $errorUrl |
||
| 629 | * |
||
| 630 | * @return $this |
||
| 631 | */ |
||
| 632 | public function setErrorUrl(?string $errorUrl) |
||
| 639 |