Complex classes like Configuration 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 Configuration, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 50 | class Configuration implements ConfigurationInterface, ListenerAwareConfigurationInterface |
||
| 51 | { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * The default PID filename to use. |
||
| 55 | * |
||
| 56 | * @var string |
||
| 57 | */ |
||
| 58 | const PID_FILENAME = 'importer.pid'; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Trait that provides CSV configuration functionality. |
||
| 62 | * |
||
| 63 | * @var \TechDivision\Import\Configuration\Jms\Configuration\CsvTrait |
||
| 64 | */ |
||
| 65 | use CsvTrait; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Trait that provides CSV configuration functionality. |
||
| 69 | * |
||
| 70 | * @var \TechDivision\Import\Configuration\Jms\Configuration\ParamsTrait |
||
| 71 | */ |
||
| 72 | use ParamsTrait; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Trait that provides CSV configuration functionality. |
||
| 76 | * |
||
| 77 | * @var \TechDivision\Import\Configuration\Jms\Configuration\ListenersTrait |
||
| 78 | */ |
||
| 79 | use ListenersTrait; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * The array with the available database types. |
||
| 83 | * |
||
| 84 | * @var array |
||
| 85 | * @Exclude |
||
| 86 | */ |
||
| 87 | protected $availableDatabaseTypes = array( |
||
| 88 | DatabaseConfigurationInterface::TYPE_MYSQL, |
||
| 89 | DatabaseConfigurationInterface::TYPE_REDIS |
||
| 90 | ); |
||
| 91 | |||
| 92 | /** |
||
| 93 | * The operation names to be executed. |
||
| 94 | * |
||
| 95 | * @var array |
||
| 96 | * @Exclude |
||
| 97 | */ |
||
| 98 | protected $operationNames = array(); |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Mapping for boolean values passed on the console. |
||
| 102 | * |
||
| 103 | * @var array |
||
| 104 | * @Exclude |
||
| 105 | */ |
||
| 106 | protected $booleanMapping = array( |
||
| 107 | 'true' => true, |
||
| 108 | 'false' => false, |
||
| 109 | '1' => true, |
||
| 110 | '0' => false, |
||
| 111 | 'on' => true, |
||
| 112 | 'off' => false |
||
| 113 | ); |
||
| 114 | |||
| 115 | /** |
||
| 116 | * The serial that will be passed as commandline option (can not be specified in configuration file). |
||
| 117 | * |
||
| 118 | * @var string |
||
| 119 | * @Exclude |
||
| 120 | * @Accessor(setter="setSerial", getter="getSerial") |
||
| 121 | */ |
||
| 122 | protected $serial; |
||
| 123 | |||
| 124 | /** |
||
| 125 | * The shortcut that maps the operation names that has to be executed. |
||
| 126 | * |
||
| 127 | * @var string |
||
| 128 | * @Exclude |
||
| 129 | */ |
||
| 130 | protected $shortcut; |
||
| 131 | |||
| 132 | /** |
||
| 133 | * The prefix for the move files subject. |
||
| 134 | * |
||
| 135 | * @var string |
||
| 136 | * @Exclude |
||
| 137 | * @SerializedName("move-files-prefix") |
||
| 138 | * @Accessor(setter="setMoveFilesPrefix", getter="getMoveFilesPrefix") |
||
| 139 | */ |
||
| 140 | protected $moveFilesPrefix; |
||
| 141 | |||
| 142 | /** |
||
| 143 | * The name of the command that has been invoked. |
||
| 144 | * |
||
| 145 | * @var string |
||
| 146 | * @Exclude |
||
| 147 | */ |
||
| 148 | protected $commandName; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * The application's unique DI identifier. |
||
| 152 | * |
||
| 153 | * @var string |
||
| 154 | * @Type("string") |
||
| 155 | * @SerializedName("id") |
||
| 156 | */ |
||
| 157 | protected $id; |
||
| 158 | |||
| 159 | /** |
||
| 160 | * The system name to use. |
||
| 161 | * |
||
| 162 | * @var string |
||
| 163 | * @Type("string") |
||
| 164 | * @SerializedName("system-name") |
||
| 165 | * @Accessor(setter="setSystemName", getter="getSystemName") |
||
| 166 | */ |
||
| 167 | protected $systemName; |
||
| 168 | |||
| 169 | /** |
||
| 170 | * The entity type code to use. |
||
| 171 | * |
||
| 172 | * @var string |
||
| 173 | * @Type("string") |
||
| 174 | * @SerializedName("entity-type-code") |
||
| 175 | */ |
||
| 176 | protected $entityTypeCode; |
||
| 177 | |||
| 178 | /** |
||
| 179 | * The Magento installation directory. |
||
| 180 | * |
||
| 181 | * @var string |
||
| 182 | * @Type("string") |
||
| 183 | * @SerializedName("installation-dir") |
||
| 184 | * @Accessor(setter="setInstallationDir", getter="getInstallationDir") |
||
| 185 | */ |
||
| 186 | protected $installationDir; |
||
| 187 | |||
| 188 | /** |
||
| 189 | * The source directory that has to be watched for new files. |
||
| 190 | * |
||
| 191 | * @var string |
||
| 192 | * @Type("string") |
||
| 193 | * @SerializedName("source-dir") |
||
| 194 | * @Accessor(setter="setSourceDir", getter="getSourceDir") |
||
| 195 | */ |
||
| 196 | protected $sourceDir; |
||
| 197 | |||
| 198 | /** |
||
| 199 | * The target directory with the files that has been imported. |
||
| 200 | * |
||
| 201 | * @var string |
||
| 202 | * @Type("string") |
||
| 203 | * @SerializedName("target-dir") |
||
| 204 | * @Accessor(setter="setTargetDir", getter="getTargetDir") |
||
| 205 | */ |
||
| 206 | protected $targetDir; |
||
| 207 | |||
| 208 | /** |
||
| 209 | * The Magento edition, EE or CE. |
||
| 210 | * |
||
| 211 | * @var string |
||
| 212 | * @Type("string") |
||
| 213 | * @SerializedName("magento-edition") |
||
| 214 | * @Accessor(setter="setMagentoEdition", getter="getMagentoEdition") |
||
| 215 | */ |
||
| 216 | protected $magentoEdition = 'CE'; |
||
| 217 | |||
| 218 | /** |
||
| 219 | * The Magento version, e. g. 2.2.0. |
||
| 220 | * |
||
| 221 | * @var string |
||
| 222 | * @Type("string") |
||
| 223 | * @SerializedName("magento-version") |
||
| 224 | * @Accessor(setter="setMagentoVersion", getter="getMagentoVersion") |
||
| 225 | */ |
||
| 226 | protected $magentoVersion = '2.2.0'; |
||
| 227 | |||
| 228 | /** |
||
| 229 | * ArrayCollection with the information of the configured databases. |
||
| 230 | * |
||
| 231 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 232 | * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Database>") |
||
| 233 | */ |
||
| 234 | protected $databases; |
||
| 235 | |||
| 236 | /** |
||
| 237 | * ArrayCollection with the information of the configured loggers. |
||
| 238 | * |
||
| 239 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 240 | * @Type("ArrayCollection<string, TechDivision\Import\Configuration\Jms\Configuration\Logger>") |
||
| 241 | */ |
||
| 242 | protected $loggers; |
||
| 243 | |||
| 244 | /** |
||
| 245 | * The subject's multiple field delimiter character for fields with multiple values, defaults to (,). |
||
| 246 | * |
||
| 247 | * @var string |
||
| 248 | * @Type("string") |
||
| 249 | * @SerializedName("multiple-field-delimiter") |
||
| 250 | */ |
||
| 251 | protected $multipleFieldDelimiter = ','; |
||
| 252 | |||
| 253 | /** |
||
| 254 | * The subject's multiple value delimiter character for fields with multiple values, defaults to (|). |
||
| 255 | * |
||
| 256 | * @var string |
||
| 257 | * @Type("string") |
||
| 258 | * @SerializedName("multiple-value-delimiter") |
||
| 259 | */ |
||
| 260 | protected $multipleValueDelimiter = '|'; |
||
| 261 | |||
| 262 | /** |
||
| 263 | * The flag to signal that the subject has to use the strict mode or not. |
||
| 264 | * |
||
| 265 | * @var boolean |
||
| 266 | * @Type("boolean") |
||
| 267 | * @SerializedName("strict-mode") |
||
| 268 | */ |
||
| 269 | protected $strictMode; |
||
| 270 | |||
| 271 | /** |
||
| 272 | * The flag whether or not the import artefacts have to be archived. |
||
| 273 | * |
||
| 274 | * @var boolean |
||
| 275 | * @Type("boolean") |
||
| 276 | * @SerializedName("archive-artefacts") |
||
| 277 | * @Accessor(setter="setArchiveArtefacts", getter="haveArchiveArtefacts") |
||
| 278 | */ |
||
| 279 | protected $archiveArtefacts = true; |
||
| 280 | |||
| 281 | /** |
||
| 282 | * The flag whether or not the import artefacts have to be cleared. |
||
| 283 | * |
||
| 284 | * @var boolean |
||
| 285 | * @Type("boolean") |
||
| 286 | * @SerializedName("clear-artefacts") |
||
| 287 | * @Accessor(setter="setClearArtefacts", getter="haveClearArtefacts") |
||
| 288 | */ |
||
| 289 | protected $clearArtefacts = true; |
||
| 290 | |||
| 291 | /** |
||
| 292 | * The directory where the archives will be stored. |
||
| 293 | * |
||
| 294 | * @var string |
||
| 295 | * @Type("string") |
||
| 296 | * @SerializedName("archive-dir") |
||
| 297 | * @Accessor(setter="setArchiveDir", getter="getArchiveDir") |
||
| 298 | */ |
||
| 299 | protected $archiveDir; |
||
| 300 | |||
| 301 | /** |
||
| 302 | * The flag to signal that the subject has to use the debug mode or not. |
||
| 303 | * |
||
| 304 | * @var boolean |
||
| 305 | * @Type("boolean") |
||
| 306 | * @SerializedName("debug-mode") |
||
| 307 | * @Accessor(setter="setDebugMode", getter="isDebugMode") |
||
| 308 | */ |
||
| 309 | protected $debugMode = false; |
||
| 310 | |||
| 311 | /** |
||
| 312 | * The log level to use (see Monolog documentation). |
||
| 313 | * |
||
| 314 | * @var string |
||
| 315 | * @Type("string") |
||
| 316 | * @SerializedName("log-level") |
||
| 317 | * @Accessor(setter="setLogLevel", getter="getLogLevel") |
||
| 318 | */ |
||
| 319 | protected $logLevel = LogLevel::INFO; |
||
| 320 | |||
| 321 | /** |
||
| 322 | * The explicit DB ID to use. |
||
| 323 | * |
||
| 324 | * @var string |
||
| 325 | * @Type("string") |
||
| 326 | * @SerializedName("use-db-id") |
||
| 327 | */ |
||
| 328 | protected $useDbId; |
||
| 329 | |||
| 330 | /** |
||
| 331 | * The explicit PID filename to use. |
||
| 332 | * |
||
| 333 | * @var string |
||
| 334 | * @Type("string") |
||
| 335 | * @SerializedName("pid-filename") |
||
| 336 | * @Accessor(setter="setPidFilename", getter="getPidFilename") |
||
| 337 | */ |
||
| 338 | protected $pidFilename; |
||
| 339 | |||
| 340 | /** |
||
| 341 | * The collection with the paths to additional vendor directories. |
||
| 342 | * |
||
| 343 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 344 | * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\VendorDir>") |
||
| 345 | * @SerializedName("additional-vendor-dirs") |
||
| 346 | */ |
||
| 347 | protected $additionalVendorDirs; |
||
| 348 | |||
| 349 | /** |
||
| 350 | * ArrayCollection with the information of the configured operations. |
||
| 351 | * |
||
| 352 | * @var array |
||
| 353 | * @Type("array<string, array<string, ArrayCollection<string, TechDivision\Import\Configuration\Jms\Configuration\Operation>>>") |
||
| 354 | */ |
||
| 355 | protected $operations = array(); |
||
| 356 | |||
| 357 | /** |
||
| 358 | * The array with the Magento Edition specific extension libraries. |
||
| 359 | * |
||
| 360 | * @var array |
||
| 361 | * @Type("array") |
||
| 362 | * @SerializedName("extension-libraries") |
||
| 363 | */ |
||
| 364 | protected $extensionLibraries = array(); |
||
| 365 | |||
| 366 | /** |
||
| 367 | * The array with the custom header mappings. |
||
| 368 | * |
||
| 369 | * @var array |
||
| 370 | * @SerializedName("header-mappings") |
||
| 371 | * @Type("array<string, array<string, string>>") |
||
| 372 | */ |
||
| 373 | protected $headerMappings = array(); |
||
| 374 | |||
| 375 | /** |
||
| 376 | * The array with the custom image types. |
||
| 377 | * |
||
| 378 | * @var array |
||
| 379 | * @Type("array") |
||
| 380 | * @SerializedName("image-types") |
||
| 381 | */ |
||
| 382 | protected $imageTypes = array(); |
||
| 383 | |||
| 384 | /** |
||
| 385 | * The flag to signal that the import should be wrapped within a single transation or not. |
||
| 386 | * |
||
| 387 | * @var boolean |
||
| 388 | * @Type("boolean") |
||
| 389 | * @SerializedName("single-transaction") |
||
| 390 | * @Accessor(setter="setSingleTransaction", getter="isSingleTransaction") |
||
| 391 | */ |
||
| 392 | protected $singleTransaction = false; |
||
| 393 | |||
| 394 | /** |
||
| 395 | * The flag to signal that the cache should be enabled or not. |
||
| 396 | * |
||
| 397 | * @var boolean |
||
| 398 | * @Type("boolean") |
||
| 399 | * @SerializedName("cache-enabled") |
||
| 400 | * @Accessor(setter="setCacheEnabled", getter="isCacheEnabled") |
||
| 401 | */ |
||
| 402 | protected $cacheEnabled = false; |
||
| 403 | |||
| 404 | /** |
||
| 405 | * ArrayCollection with the information of the configured aliases. |
||
| 406 | * |
||
| 407 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 408 | * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Alias>") |
||
| 409 | */ |
||
| 410 | protected $aliases; |
||
| 411 | |||
| 412 | /** |
||
| 413 | * ArrayCollection with the information of the configured caches. |
||
| 414 | * |
||
| 415 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 416 | * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Cache>") |
||
| 417 | */ |
||
| 418 | protected $caches; |
||
| 419 | |||
| 420 | /** |
||
| 421 | * The array with the shortcuts. |
||
| 422 | * |
||
| 423 | * @var array |
||
| 424 | * @Type("array<string, array<string, array>>") |
||
| 425 | * @SerializedName("shortcuts") |
||
| 426 | */ |
||
| 427 | protected $shortcuts = array(); |
||
| 428 | |||
| 429 | /** |
||
| 430 | * The username to save the import history with. |
||
| 431 | * |
||
| 432 | * @var string |
||
| 433 | * @Type("string") |
||
| 434 | */ |
||
| 435 | protected $username; |
||
| 436 | |||
| 437 | /** |
||
| 438 | * The array with the finder mappings. |
||
| 439 | * |
||
| 440 | * @var array |
||
| 441 | * @SerializedName("finder-mappings") |
||
| 442 | * @Type("array<string, string>") |
||
| 443 | * @Accessor(setter="setFinderMappings", getter="getFinderMappings") |
||
| 444 | */ |
||
| 445 | protected $finderMappings = array(); |
||
| 446 | |||
| 447 | /** |
||
| 448 | * The array with the default values. |
||
| 449 | * |
||
| 450 | * @var array |
||
| 451 | * @SerializedName("default-values") |
||
| 452 | * @Type("array<string, array<string, string>>") |
||
| 453 | * @Accessor(setter="setDefaultValues", getter="getDefaultValues") |
||
| 454 | */ |
||
| 455 | protected $defaultValues = array(); |
||
| 456 | |||
| 457 | /** |
||
| 458 | * Lifecycle callback that will be invoked after deserialization. |
||
| 459 | * |
||
| 460 | * @return void |
||
| 461 | * @PostDeserialize |
||
| 462 | */ |
||
| 463 | public function postDeserialize() |
||
| 491 | |||
| 492 | /** |
||
| 493 | * Map's the passed value to a boolean. |
||
| 494 | * |
||
| 495 | * @param string $value The value to map |
||
| 496 | * |
||
| 497 | * @return boolean The mapped value |
||
| 498 | * @throws \Exception Is thrown, if the value can't be mapped |
||
| 499 | */ |
||
| 500 | public function mapBoolean($value) |
||
| 516 | |||
| 517 | /** |
||
| 518 | * Return's the application's unique DI identifier. |
||
| 519 | * |
||
| 520 | * @return string The application's unique DI identifier |
||
| 521 | */ |
||
| 522 | public function getId() |
||
| 526 | |||
| 527 | /** |
||
| 528 | * Add's the operation with the passed name ot the operations that has to be executed. |
||
| 529 | * |
||
| 530 | * If the operation name has already been added, it'll not be added again. |
||
| 531 | * |
||
| 532 | * @param string $operationName The operation to be executed |
||
| 533 | * @param boolean $prepend TRUE if the operation name should be prepended, else FALSE |
||
| 534 | * |
||
| 535 | * @return void |
||
| 536 | */ |
||
| 537 | public function addOperationName($operationName, $prepend = false) |
||
| 548 | |||
| 549 | /** |
||
| 550 | * Return's the operation names that has to be executed. |
||
| 551 | * |
||
| 552 | * @param array $operationNames The operation names that has to be executed |
||
| 553 | * |
||
| 554 | * @return void |
||
| 555 | */ |
||
| 556 | public function setOperationNames(array $operationNames) |
||
| 560 | |||
| 561 | /** |
||
| 562 | * Return's the operation names that has to be executed. |
||
| 563 | * |
||
| 564 | * @return array The operation names that has to be executed |
||
| 565 | */ |
||
| 566 | public function getOperationNames() |
||
| 570 | |||
| 571 | /** |
||
| 572 | * Queries whether or not the passed operation has to be exceuted or not. |
||
| 573 | * |
||
| 574 | * @param \TechDivision\Import\Configuration\OperationConfigurationInterface $operation The operation to query for |
||
| 575 | * |
||
| 576 | * @return boolean TRUE if the operation has to be executed, else FALSE |
||
| 577 | */ |
||
| 578 | public function inOperationNames(OperationConfigurationInterface $operation) |
||
| 582 | |||
| 583 | /** |
||
| 584 | * Set's the Magento installation directory. |
||
| 585 | * |
||
| 586 | * @param string $installationDir The Magento installation directory |
||
| 587 | * |
||
| 588 | * @return void |
||
| 589 | */ |
||
| 590 | public function setInstallationDir($installationDir) |
||
| 594 | |||
| 595 | /** |
||
| 596 | * Return's the Magento installation directory. |
||
| 597 | * |
||
| 598 | * @return string The Magento installation directory |
||
| 599 | */ |
||
| 600 | public function getInstallationDir() |
||
| 604 | |||
| 605 | /** |
||
| 606 | * Set's the source directory that has to be watched for new files. |
||
| 607 | * |
||
| 608 | * @param string $sourceDir The source directory |
||
| 609 | * |
||
| 610 | * @return void |
||
| 611 | */ |
||
| 612 | public function setSourceDir($sourceDir) |
||
| 616 | |||
| 617 | /** |
||
| 618 | * Return's the source directory that has to be watched for new files. |
||
| 619 | * |
||
| 620 | * @return string The source directory |
||
| 621 | */ |
||
| 622 | public function getSourceDir() |
||
| 626 | |||
| 627 | /** |
||
| 628 | * Set's the target directory with the files that has been imported. |
||
| 629 | * |
||
| 630 | * @param string $targetDir The target directory |
||
| 631 | * |
||
| 632 | * @return void |
||
| 633 | */ |
||
| 634 | public function setTargetDir($targetDir) |
||
| 638 | |||
| 639 | /** |
||
| 640 | * Return's the target directory with the files that has been imported. |
||
| 641 | * |
||
| 642 | * @return string The target directory |
||
| 643 | */ |
||
| 644 | public function getTargetDir() |
||
| 648 | |||
| 649 | /** |
||
| 650 | * Set's the Magento edition, EE or CE. |
||
| 651 | * |
||
| 652 | * @param string $magentoEdition The Magento edition |
||
| 653 | * |
||
| 654 | * @return void |
||
| 655 | */ |
||
| 656 | public function setMagentoEdition($magentoEdition) |
||
| 660 | |||
| 661 | /** |
||
| 662 | * Return's the Magento edition, EE or CE. |
||
| 663 | * |
||
| 664 | * @return string The Magento edition |
||
| 665 | */ |
||
| 666 | public function getMagentoEdition() |
||
| 670 | |||
| 671 | /** |
||
| 672 | * Return's the Magento version, e. g. 2.1.0. |
||
| 673 | * |
||
| 674 | * @param string $magentoVersion The Magento version |
||
| 675 | * |
||
| 676 | * @return void |
||
| 677 | */ |
||
| 678 | public function setMagentoVersion($magentoVersion) |
||
| 682 | |||
| 683 | /** |
||
| 684 | * Return's the Magento version, e. g. 2.1.0. |
||
| 685 | * |
||
| 686 | * @return string The Magento version |
||
| 687 | */ |
||
| 688 | public function getMagentoVersion() |
||
| 692 | |||
| 693 | /** |
||
| 694 | * Return's the entity type code to be used. |
||
| 695 | * |
||
| 696 | * @return string The entity type code to be used |
||
| 697 | */ |
||
| 698 | public function getEntityTypeCode() |
||
| 702 | |||
| 703 | /** |
||
| 704 | * Set's the entity type code to be used. |
||
| 705 | * |
||
| 706 | * @param string $entityTypeCode The entity type code |
||
| 707 | * |
||
| 708 | * @return void |
||
| 709 | */ |
||
| 710 | public function setEntityTypeCode($entityTypeCode) |
||
| 714 | |||
| 715 | /** |
||
| 716 | * Return's the multiple field delimiter character to use, default value is comma (,). |
||
| 717 | * |
||
| 718 | * @return string The multiple field delimiter character |
||
| 719 | */ |
||
| 720 | public function getMultipleFieldDelimiter() |
||
| 724 | |||
| 725 | /** |
||
| 726 | * Return's the multiple value delimiter character to use, default value is comma (|). |
||
| 727 | * |
||
| 728 | * @return string The multiple value delimiter character |
||
| 729 | */ |
||
| 730 | public function getMultipleValueDelimiter() |
||
| 734 | |||
| 735 | /** |
||
| 736 | * Queries whether or not strict mode is enabled or not, default is TRUE. |
||
| 737 | * |
||
| 738 | * @return boolean TRUE if strict mode is enabled, else FALSE |
||
| 739 | */ |
||
| 740 | public function isStrictMode() |
||
| 744 | |||
| 745 | /** |
||
| 746 | * Remove's all configured database configuration. |
||
| 747 | * |
||
| 748 | * @return void |
||
| 749 | */ |
||
| 750 | public function clearDatabases() |
||
| 754 | |||
| 755 | /** |
||
| 756 | * Add's the passed database configuration. |
||
| 757 | * |
||
| 758 | * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration |
||
| 759 | * |
||
| 760 | * @return void |
||
| 761 | */ |
||
| 762 | public function addDatabase(DatabaseConfigurationInterface $database) |
||
| 766 | |||
| 767 | /** |
||
| 768 | * Return's the number database configurations. |
||
| 769 | * |
||
| 770 | * @return integer The number of database configurations |
||
| 771 | */ |
||
| 772 | public function countDatabases() |
||
| 776 | |||
| 777 | /** |
||
| 778 | * Return's the database configuration with the passed ID. |
||
| 779 | * |
||
| 780 | * @param string $id The ID of the database connection to return |
||
| 781 | * |
||
| 782 | * @return \TechDivision\Import\Configuration\DatabaseConfigurationInterface The database configuration |
||
| 783 | * @throws \Exception Is thrown, if no database configuration is available |
||
| 784 | */ |
||
| 785 | public function getDatabaseById($id) |
||
| 799 | |||
| 800 | /** |
||
| 801 | * Return's the databases for the given type. |
||
| 802 | * |
||
| 803 | * @param string $type The database type to return the configurations for |
||
| 804 | * |
||
| 805 | * @return \Doctrine\Common\Collections\Collection The collection with the database configurations |
||
| 806 | */ |
||
| 807 | public function getDatabasesByType($type) |
||
| 824 | |||
| 825 | /** |
||
| 826 | * Query's whether or not the passed database configuration has a valid type. |
||
| 827 | * |
||
| 828 | * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration |
||
| 829 | * |
||
| 830 | * @return boolean TRUE if the passed database configuration has a valid type, else FALSE |
||
| 831 | */ |
||
| 832 | protected function isValidDatabaseType(DatabaseConfigurationInterface $database) |
||
| 836 | |||
| 837 | /** |
||
| 838 | * Return's the database configuration. |
||
| 839 | * |
||
| 840 | * If an explicit DB ID is specified, the method tries to return the database with this ID. If |
||
| 841 | * the database configuration is NOT available, an execption is thrown. |
||
| 842 | * |
||
| 843 | * If no explicit DB ID is specified, the method tries to return the default database configuration, |
||
| 844 | * if not available the first one. |
||
| 845 | * |
||
| 846 | * @return \TechDivision\Import\Configuration\DatabaseConfigurationInterface The database configuration |
||
| 847 | * @throws \Exception Is thrown, if no database configuration is available |
||
| 848 | */ |
||
| 849 | public function getDatabase() |
||
| 873 | |||
| 874 | /** |
||
| 875 | * Return's the array with the configured operations. |
||
| 876 | * |
||
| 877 | * @return array The array with the operations |
||
| 878 | */ |
||
| 879 | public function getOperations() |
||
| 883 | |||
| 884 | /** |
||
| 885 | * Return's the ArrayCollection with the configured shortcuts. |
||
| 886 | * |
||
| 887 | * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the shortcuts |
||
| 888 | */ |
||
| 889 | public function getShortcuts() |
||
| 893 | |||
| 894 | /** |
||
| 895 | * Return's the ArrayCollection with the configured loggers. |
||
| 896 | * |
||
| 897 | * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the loggers |
||
| 898 | */ |
||
| 899 | public function getLoggers() |
||
| 903 | |||
| 904 | /** |
||
| 905 | * Set's the flag that import artefacts have to be archived or not. |
||
| 906 | * |
||
| 907 | * @param mixed $archiveArtefacts TRUE if artefacts have to be archived, else FALSE |
||
| 908 | * |
||
| 909 | * @return void |
||
| 910 | */ |
||
| 911 | public function setArchiveArtefacts($archiveArtefacts) |
||
| 915 | |||
| 916 | /** |
||
| 917 | * Return's the TRUE if the import artefacts have to be archived. |
||
| 918 | * |
||
| 919 | * @return boolean TRUE if the import artefacts have to be archived |
||
| 920 | */ |
||
| 921 | public function haveArchiveArtefacts() |
||
| 925 | |||
| 926 | /** |
||
| 927 | * Set's the flag that import artefacts have to be cleared or not. |
||
| 928 | * |
||
| 929 | * @param mixed $clearArtefacts TRUE if artefacts have to be cleared, else FALSE |
||
| 930 | * |
||
| 931 | * @return void |
||
| 932 | */ |
||
| 933 | public function setClearArtefacts($clearArtefacts) |
||
| 937 | |||
| 938 | /** |
||
| 939 | * Return's the TRUE if the import artefacts have to be cleared after the import process. |
||
| 940 | * |
||
| 941 | * @return boolean TRUE if the import artefacts have to be cleared |
||
| 942 | */ |
||
| 943 | public function haveClearArtefacts() |
||
| 947 | |||
| 948 | /** |
||
| 949 | * The directory where the archives will be stored. |
||
| 950 | * |
||
| 951 | * @param string $archiveDir The archive directory |
||
| 952 | * |
||
| 953 | * @return void |
||
| 954 | */ |
||
| 955 | public function setArchiveDir($archiveDir) |
||
| 959 | |||
| 960 | /** |
||
| 961 | * The directory where the archives will be stored. |
||
| 962 | * |
||
| 963 | * @return string The archive directory |
||
| 964 | */ |
||
| 965 | public function getArchiveDir() |
||
| 969 | |||
| 970 | /** |
||
| 971 | * Set's the debug mode. |
||
| 972 | * |
||
| 973 | * @param mixed $debugMode TRUE if debug mode is enabled, else FALSE |
||
| 974 | * |
||
| 975 | * @return void |
||
| 976 | */ |
||
| 977 | public function setDebugMode($debugMode) |
||
| 981 | |||
| 982 | /** |
||
| 983 | * Queries whether or not debug mode is enabled or not, default is TRUE. |
||
| 984 | * |
||
| 985 | * @return boolean TRUE if debug mode is enabled, else FALSE |
||
| 986 | */ |
||
| 987 | public function isDebugMode() |
||
| 991 | |||
| 992 | /** |
||
| 993 | * Set's the log level to use. |
||
| 994 | * |
||
| 995 | * @param string $logLevel The log level to use |
||
| 996 | * |
||
| 997 | * @return void |
||
| 998 | */ |
||
| 999 | public function setLogLevel($logLevel) |
||
| 1003 | |||
| 1004 | /** |
||
| 1005 | * Return's the log level to use. |
||
| 1006 | * |
||
| 1007 | * @return string The log level to use |
||
| 1008 | */ |
||
| 1009 | public function getLogLevel() |
||
| 1013 | |||
| 1014 | /** |
||
| 1015 | * Set's the explicit DB ID to use. |
||
| 1016 | * |
||
| 1017 | * @param string $useDbId The explicit DB ID to use |
||
| 1018 | * |
||
| 1019 | * @return void |
||
| 1020 | */ |
||
| 1021 | public function setUseDbId($useDbId) |
||
| 1025 | |||
| 1026 | /** |
||
| 1027 | * Return's the explicit DB ID to use. |
||
| 1028 | * |
||
| 1029 | * @return string The explicit DB ID to use |
||
| 1030 | */ |
||
| 1031 | public function getUseDbId() |
||
| 1035 | |||
| 1036 | /** |
||
| 1037 | * Set's the PID filename to use. |
||
| 1038 | * |
||
| 1039 | * @param string $pidFilename The PID filename to use |
||
| 1040 | * |
||
| 1041 | * @return void |
||
| 1042 | */ |
||
| 1043 | public function setPidFilename($pidFilename) |
||
| 1047 | |||
| 1048 | /** |
||
| 1049 | * Return's the PID filename to use. |
||
| 1050 | * |
||
| 1051 | * @return string The PID filename to use |
||
| 1052 | */ |
||
| 1053 | public function getPidFilename() |
||
| 1057 | |||
| 1058 | /** |
||
| 1059 | * Set's the systemm name to be used. |
||
| 1060 | * |
||
| 1061 | * @param string $systemName The system name to be used |
||
| 1062 | * |
||
| 1063 | * @return void |
||
| 1064 | */ |
||
| 1065 | public function setSystemName($systemName) |
||
| 1069 | |||
| 1070 | /** |
||
| 1071 | * Return's the systemm name to be used. |
||
| 1072 | * |
||
| 1073 | * @return string The system name to be used |
||
| 1074 | */ |
||
| 1075 | public function getSystemName() |
||
| 1079 | |||
| 1080 | /** |
||
| 1081 | * Set's the collection with the path of the Magento Edition specific extension libraries. |
||
| 1082 | * |
||
| 1083 | * @param array $extensionLibraries The paths of the Magento Edition specific extension libraries |
||
| 1084 | * |
||
| 1085 | * @return void |
||
| 1086 | */ |
||
| 1087 | public function setExtensionLibraries(array $extensionLibraries) |
||
| 1091 | |||
| 1092 | /** |
||
| 1093 | * Return's an array with the path of the Magento Edition specific extension libraries. |
||
| 1094 | * |
||
| 1095 | * @return array The paths of the Magento Edition specific extension libraries |
||
| 1096 | */ |
||
| 1097 | public function getExtensionLibraries() |
||
| 1101 | |||
| 1102 | /** |
||
| 1103 | * Return's a collection with the path to additional vendor directories. |
||
| 1104 | * |
||
| 1105 | * @return \Doctrine\Common\Collections\ArrayCollection The paths to additional vendor directories |
||
| 1106 | */ |
||
| 1107 | public function getAdditionalVendorDirs() |
||
| 1111 | |||
| 1112 | /** |
||
| 1113 | * The array with the subject's custom header mappings. |
||
| 1114 | * |
||
| 1115 | * @return array The custom header mappings |
||
| 1116 | */ |
||
| 1117 | public function getHeaderMappings() |
||
| 1121 | |||
| 1122 | /** |
||
| 1123 | * The array with the subject's custom image types. |
||
| 1124 | * |
||
| 1125 | * @return array The custom image types |
||
| 1126 | */ |
||
| 1127 | public function getImageTypes() |
||
| 1131 | |||
| 1132 | /** |
||
| 1133 | * Set's the flag that decides whether or not the import should be wrapped within a single transaction. |
||
| 1134 | * |
||
| 1135 | * @param mixed $singleTransaction TRUE if the import should be wrapped in a single transation, else FALSE |
||
| 1136 | * |
||
| 1137 | * @return void |
||
| 1138 | */ |
||
| 1139 | public function setSingleTransaction($singleTransaction) |
||
| 1143 | |||
| 1144 | /** |
||
| 1145 | * Whether or not the import should be wrapped within a single transation. |
||
| 1146 | * |
||
| 1147 | * @return boolean TRUE if the import should be wrapped in a single transation, else FALSE |
||
| 1148 | */ |
||
| 1149 | public function isSingleTransaction() |
||
| 1153 | |||
| 1154 | /** |
||
| 1155 | * Set's the flag that decides whether or not the the cache has been enabled. |
||
| 1156 | * |
||
| 1157 | * @param mixed $cacheEnabled TRUE if the cache has been enabled, else FALSE |
||
| 1158 | * |
||
| 1159 | * @return void |
||
| 1160 | */ |
||
| 1161 | public function setCacheEnabled($cacheEnabled) |
||
| 1165 | |||
| 1166 | /** |
||
| 1167 | * Whether or not the cache functionality should be enabled. |
||
| 1168 | * |
||
| 1169 | * @return boolean TRUE if the cache has to be enabled, else FALSE |
||
| 1170 | */ |
||
| 1171 | public function isCacheEnabled() |
||
| 1175 | |||
| 1176 | /** |
||
| 1177 | * Set's the passed serial from the commandline to the configuration. |
||
| 1178 | * |
||
| 1179 | * @param string $serial The serial from the commandline |
||
| 1180 | * |
||
| 1181 | * @return void |
||
| 1182 | */ |
||
| 1183 | public function setSerial($serial) |
||
| 1187 | |||
| 1188 | /** |
||
| 1189 | * Return's the serial from the commandline. |
||
| 1190 | * |
||
| 1191 | * @return string The serial |
||
| 1192 | */ |
||
| 1193 | public function getSerial() |
||
| 1197 | |||
| 1198 | /** |
||
| 1199 | * Return's the configuration for the caches. |
||
| 1200 | * |
||
| 1201 | * @return \Doctrine\Common\Collections\ArrayCollection The cache configurations |
||
| 1202 | */ |
||
| 1203 | public function getCaches() |
||
| 1214 | |||
| 1215 | /** |
||
| 1216 | * Return's the cache configuration for the passed type. |
||
| 1217 | * |
||
| 1218 | * @param string $type The cache type to return the configuation for |
||
| 1219 | * |
||
| 1220 | * @return \TechDivision\Import\Configuration\CacheConfigurationInterface The cache configuration |
||
| 1221 | */ |
||
| 1222 | public function getCacheByType($type) |
||
| 1236 | |||
| 1237 | /** |
||
| 1238 | * Return's the alias configuration. |
||
| 1239 | * |
||
| 1240 | * @return \Doctrine\Common\Collections\ArrayCollection The alias configuration |
||
| 1241 | */ |
||
| 1242 | public function getAliases() |
||
| 1246 | |||
| 1247 | /** |
||
| 1248 | * Set's the prefix for the move files subject. |
||
| 1249 | * |
||
| 1250 | * @param string $moveFilesPrefix The prefix for the move files subject |
||
| 1251 | * |
||
| 1252 | * @return void |
||
| 1253 | */ |
||
| 1254 | public function setMoveFilesPrefix($moveFilesPrefix) |
||
| 1258 | |||
| 1259 | /** |
||
| 1260 | * Return's the prefix for the move files subject. |
||
| 1261 | * |
||
| 1262 | * @return string The prefix for the move files subject |
||
| 1263 | */ |
||
| 1264 | public function getMoveFilesPrefix() |
||
| 1268 | |||
| 1269 | /** |
||
| 1270 | * Set's the shortcut that maps the operation names that has to be executed. |
||
| 1271 | * |
||
| 1272 | * @param string $shortcut The shortcut |
||
| 1273 | * |
||
| 1274 | * @return void |
||
| 1275 | */ |
||
| 1276 | public function setShortcut($shortcut) |
||
| 1280 | |||
| 1281 | /** |
||
| 1282 | * Return's the shortcut that maps the operation names that has to be executed. |
||
| 1283 | * |
||
| 1284 | * @return string The shortcut |
||
| 1285 | */ |
||
| 1286 | public function getShortcut() |
||
| 1290 | |||
| 1291 | /** |
||
| 1292 | * Set's the name of the command that has been invoked. |
||
| 1293 | * |
||
| 1294 | * @param string $commandName The command name |
||
| 1295 | * |
||
| 1296 | * @return void |
||
| 1297 | */ |
||
| 1298 | public function setCommandName($commandName) |
||
| 1302 | |||
| 1303 | /** |
||
| 1304 | * Return's the name of the command that has been invoked. |
||
| 1305 | * |
||
| 1306 | * @return string The command name |
||
| 1307 | */ |
||
| 1308 | public function getCommandName() |
||
| 1312 | |||
| 1313 | /** |
||
| 1314 | * Set's the username to save the import history with. |
||
| 1315 | * |
||
| 1316 | * @param string $username The username |
||
| 1317 | * |
||
| 1318 | * @return void |
||
| 1319 | */ |
||
| 1320 | public function setUsername($username) |
||
| 1324 | |||
| 1325 | /** |
||
| 1326 | * Return's the username to save the import history with. |
||
| 1327 | * |
||
| 1328 | * @return string The username |
||
| 1329 | */ |
||
| 1330 | public function getUsername() |
||
| 1334 | |||
| 1335 | /** |
||
| 1336 | * Set's the array with the finder mappings. |
||
| 1337 | * |
||
| 1338 | * @param array $finderMappings The finder mappings |
||
| 1339 | * |
||
| 1340 | * @return void |
||
| 1341 | */ |
||
| 1342 | public function setFinderMappings(array $finderMappings) |
||
| 1350 | |||
| 1351 | /** |
||
| 1352 | * Return's the array with the finder mappings. |
||
| 1353 | * |
||
| 1354 | * @return array The finder mappings |
||
| 1355 | */ |
||
| 1356 | public function getFinderMappings() |
||
| 1360 | |||
| 1361 | /** |
||
| 1362 | * Return's the mapped finder for the passed key. |
||
| 1363 | * |
||
| 1364 | * @param string $key The key of the finder to map |
||
| 1365 | * |
||
| 1366 | * @return string The mapped finder name |
||
| 1367 | * @throws \InvalidArgumentException Is thrown if the mapping with passed key can not be resolved |
||
| 1368 | */ |
||
| 1369 | public function getFinderMappingByKey($key) |
||
| 1380 | |||
| 1381 | /** |
||
| 1382 | * Sets the default values from the configuration. |
||
| 1383 | * |
||
| 1384 | * @param array $defaultValues The array with the default values |
||
| 1385 | * |
||
| 1386 | * @return void |
||
| 1387 | */ |
||
| 1388 | public function setDefaultValues(array $defaultValues) |
||
| 1392 | |||
| 1393 | /** |
||
| 1394 | * Load the default values from the configuration. |
||
| 1395 | * |
||
| 1396 | * @return array The array with the default values |
||
| 1397 | */ |
||
| 1398 | public function getDefaultValues() |
||
| 1402 | |||
| 1403 | /** |
||
| 1404 | * Return's an unique array with the prefixes of all configured subjects. |
||
| 1405 | * |
||
| 1406 | * @param array $ignore An array with prefixes that has to be ignored |
||
| 1407 | * |
||
| 1408 | * @return array An array with the available prefixes |
||
| 1409 | */ |
||
| 1410 | public function getPrefixes($ignore = array('.*')) |
||
| 1439 | |||
| 1440 | /** |
||
| 1441 | * Return's an array with the subjects which prefix is NOT in the passed |
||
| 1442 | * array of blacklisted prefixes and that matches the filters. |
||
| 1443 | * |
||
| 1444 | * @param callable[] $filters An array with filters to filter the subjects that has to be returned |
||
| 1445 | * |
||
| 1446 | * @return array An array with the matching subjects |
||
| 1447 | */ |
||
| 1448 | public function getSubjects(array $filters = array()) |
||
| 1476 | } |
||
| 1477 |