Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like AbstractSubject 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 AbstractSubject, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 54 | abstract class AbstractSubject implements SubjectInterface, FilesystemSubjectInterface, DateConverterSubjectInterface |
||
| 55 | { |
||
| 56 | |||
| 57 | /** |
||
| 58 | * The trait that provides basic filesystem handling functionality. |
||
| 59 | * |
||
| 60 | * @var \TechDivision\Import\Subjects\FilesystemTrait |
||
| 61 | */ |
||
| 62 | use FilesystemTrait; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * The trait that provides basic filesystem handling functionality. |
||
| 66 | * |
||
| 67 | * @var \TechDivision\Import\SystemLoggerTrait |
||
| 68 | */ |
||
| 69 | use SystemLoggerTrait; |
||
| 70 | |||
| 71 | /** |
||
| 72 | * The trait that provides date converting functionality. |
||
| 73 | * |
||
| 74 | * @var \TechDivision\Import\DateConverterTrait |
||
| 75 | */ |
||
| 76 | use DateConverterTrait; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * The trait that provides header handling functionality. |
||
| 80 | * |
||
| 81 | * @var \TechDivision\Import\HeaderTrait |
||
| 82 | */ |
||
| 83 | use HeaderTrait; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * The trait that provides row handling functionality. |
||
| 87 | * |
||
| 88 | * @var \TechDivision\Import\RowTrait |
||
| 89 | */ |
||
| 90 | use RowTrait; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * The unique identifier for the actual invocation. |
||
| 94 | * |
||
| 95 | * @var string |
||
| 96 | */ |
||
| 97 | protected $uniqueId; |
||
| 98 | |||
| 99 | /** |
||
| 100 | * The name of the file to be imported. |
||
| 101 | * |
||
| 102 | * @var string |
||
| 103 | */ |
||
| 104 | protected $filename; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * The actual line number. |
||
| 108 | * |
||
| 109 | * @var integer |
||
| 110 | */ |
||
| 111 | protected $lineNumber = 0; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * The import adapter instance. |
||
| 115 | * |
||
| 116 | * @var \TechDivision\Import\Adapter\ImportAdapterInterface |
||
| 117 | */ |
||
| 118 | protected $importAdapter; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * The subject configuration. |
||
| 122 | * |
||
| 123 | * @var \TechDivision\Import\Configuration\SubjectConfigurationInterface |
||
| 124 | */ |
||
| 125 | protected $configuration; |
||
| 126 | |||
| 127 | /** |
||
| 128 | * The plugin configuration. |
||
| 129 | * |
||
| 130 | * @var \TechDivision\Import\Configuration\PluginConfigurationInterface |
||
| 131 | */ |
||
| 132 | protected $pluginConfiguration; |
||
| 133 | |||
| 134 | /** |
||
| 135 | * The RegistryProcessor instance to handle running threads. |
||
| 136 | * |
||
| 137 | * @var \TechDivision\Import\Services\RegistryProcessorInterface |
||
| 138 | */ |
||
| 139 | protected $registryProcessor; |
||
| 140 | |||
| 141 | /** |
||
| 142 | * The actions unique serial. |
||
| 143 | * |
||
| 144 | * @var string |
||
| 145 | */ |
||
| 146 | protected $serial; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * Array with the subject's observers. |
||
| 150 | * |
||
| 151 | * @var array |
||
| 152 | */ |
||
| 153 | protected $observers = array(); |
||
| 154 | |||
| 155 | /** |
||
| 156 | * Array with the subject's callbacks. |
||
| 157 | * |
||
| 158 | * @var array |
||
| 159 | */ |
||
| 160 | protected $callbacks = array(); |
||
| 161 | |||
| 162 | /** |
||
| 163 | * The subject's callback mappings. |
||
| 164 | * |
||
| 165 | * @var array |
||
| 166 | */ |
||
| 167 | protected $callbackMappings = array(); |
||
| 168 | |||
| 169 | /** |
||
| 170 | * The available root categories. |
||
| 171 | * |
||
| 172 | * @var array |
||
| 173 | */ |
||
| 174 | protected $rootCategories = array(); |
||
| 175 | |||
| 176 | /** |
||
| 177 | * The Magento configuration. |
||
| 178 | * |
||
| 179 | * @var array |
||
| 180 | */ |
||
| 181 | protected $coreConfigData = array(); |
||
| 182 | |||
| 183 | /** |
||
| 184 | * The available stores. |
||
| 185 | * |
||
| 186 | * @var array |
||
| 187 | */ |
||
| 188 | protected $stores = array(); |
||
| 189 | |||
| 190 | /** |
||
| 191 | * The available websites. |
||
| 192 | * |
||
| 193 | * @var array |
||
| 194 | */ |
||
| 195 | protected $storeWebsites = array(); |
||
| 196 | |||
| 197 | /** |
||
| 198 | * The default store. |
||
| 199 | * |
||
| 200 | * @var array |
||
| 201 | */ |
||
| 202 | protected $defaultStore; |
||
| 203 | |||
| 204 | /** |
||
| 205 | * The store view code the create the product/attributes for. |
||
| 206 | * |
||
| 207 | * @var string |
||
| 208 | */ |
||
| 209 | protected $storeViewCode; |
||
| 210 | |||
| 211 | /** |
||
| 212 | * The UID generator for the core config data. |
||
| 213 | * |
||
| 214 | * @var \TechDivision\Import\Utils\Generators\GeneratorInterface |
||
| 215 | */ |
||
| 216 | protected $coreConfigDataUidGenerator; |
||
| 217 | |||
| 218 | /** |
||
| 219 | * UNIX timestamp with the date the last row counter has been logged. |
||
| 220 | * |
||
| 221 | * @var integer |
||
| 222 | */ |
||
| 223 | protected $lastLog = 0; |
||
| 224 | |||
| 225 | /** |
||
| 226 | * The number of the last line that has been logged with the row counter |
||
| 227 | * @var integer |
||
| 228 | */ |
||
| 229 | protected $lastLineNumber = 0; |
||
| 230 | |||
| 231 | /** |
||
| 232 | * The event emitter instance. |
||
| 233 | * |
||
| 234 | * @var \League\Event\EmitterInterface |
||
| 235 | */ |
||
| 236 | protected $emitter; |
||
| 237 | |||
| 238 | /** |
||
| 239 | * The status of the file (0 = not processed, 1 = successfully processed, 2 = processed with failure) |
||
| 240 | * |
||
| 241 | * @var array |
||
| 242 | */ |
||
| 243 | protected $status = array(); |
||
| 244 | |||
| 245 | /** |
||
| 246 | * The default values for the columns from the configuration. |
||
| 247 | * |
||
| 248 | * @var array |
||
| 249 | */ |
||
| 250 | protected $defaultColumnValues = array(); |
||
| 251 | |||
| 252 | /** |
||
| 253 | * The values of the actual column, pre-initialized with the default values. |
||
| 254 | * |
||
| 255 | * @var array |
||
| 256 | */ |
||
| 257 | protected $columnValues = array(); |
||
| 258 | |||
| 259 | /** |
||
| 260 | * Mapping for the virtual entity type code to the real Magento 2 EAV entity type code. |
||
| 261 | * |
||
| 262 | * @var array |
||
| 263 | */ |
||
| 264 | protected $entityTypeCodeMappings = array( |
||
| 265 | EntityTypeCodes::EAV_ATTRIBUTE => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 266 | EntityTypeCodes::EAV_ATTRIBUTE_SET => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 267 | EntityTypeCodes::CATALOG_PRODUCT_URL => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 268 | EntityTypeCodes::CATALOG_PRODUCT_PRICE => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 269 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 270 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY_MSI => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 271 | EntityTypeCodes::CATALOG_PRODUCT_TIER_PRICE => EntityTypeCodes::CATALOG_PRODUCT |
||
| 272 | ); |
||
| 273 | |||
| 274 | /** |
||
| 275 | * Initialize the subject instance. |
||
| 276 | * |
||
| 277 | * @param \TechDivision\Import\Services\RegistryProcessorInterface $registryProcessor The registry processor instance |
||
| 278 | * @param \TechDivision\Import\Utils\Generators\GeneratorInterface $coreConfigDataUidGenerator The UID generator for the core config data |
||
| 279 | * @param \Doctrine\Common\Collections\Collection $systemLoggers The array with the system loggers instances |
||
| 280 | * @param \League\Event\EmitterInterface $emitter The event emitter instance |
||
| 281 | */ |
||
| 282 | public function __construct( |
||
| 293 | |||
| 294 | /** |
||
| 295 | * Return's the event emitter instance. |
||
| 296 | * |
||
| 297 | * @return \League\Event\EmitterInterface The event emitter instance |
||
| 298 | */ |
||
| 299 | public function getEmitter() |
||
| 303 | |||
| 304 | /** |
||
| 305 | * Set's the name of the file to import |
||
| 306 | * |
||
| 307 | * @param string $filename The filename |
||
| 308 | * |
||
| 309 | * @return void |
||
| 310 | */ |
||
| 311 | public function setFilename($filename) |
||
| 315 | |||
| 316 | /** |
||
| 317 | * Return's the name of the file to import. |
||
| 318 | * |
||
| 319 | * @return string The filename |
||
| 320 | */ |
||
| 321 | public function getFilename() |
||
| 325 | |||
| 326 | /** |
||
| 327 | * Set's the actual line number. |
||
| 328 | * |
||
| 329 | * @param integer $lineNumber The line number |
||
| 330 | * |
||
| 331 | * @return void |
||
| 332 | */ |
||
| 333 | public function setLineNumber($lineNumber) |
||
| 337 | |||
| 338 | /** |
||
| 339 | * Return's the actual line number. |
||
| 340 | * |
||
| 341 | * @return integer The line number |
||
| 342 | */ |
||
| 343 | public function getLineNumber() |
||
| 347 | |||
| 348 | /** |
||
| 349 | * Return's the default callback mappings. |
||
| 350 | * |
||
| 351 | * @return array The default callback mappings |
||
| 352 | */ |
||
| 353 | public function getDefaultCallbackMappings() |
||
| 357 | |||
| 358 | /** |
||
| 359 | * Load the default column values from the configuration. |
||
| 360 | * |
||
| 361 | * @return array The array with the default column values |
||
| 362 | */ |
||
| 363 | View Code Duplication | public function getDefaultColumnValues() |
|
| 383 | |||
| 384 | /** |
||
| 385 | * Load the default header mappings from the configuration. |
||
| 386 | * |
||
| 387 | * @return array The array with the default header mappings |
||
| 388 | */ |
||
| 389 | View Code Duplication | public function getDefaultHeaderMappings() |
|
| 409 | |||
| 410 | /** |
||
| 411 | * Tries to format the passed value to a valid date with format 'Y-m-d H:i:s'. |
||
| 412 | * If the passed value is NOT a valid date, NULL will be returned. |
||
| 413 | * |
||
| 414 | * @param string $value The value to format |
||
| 415 | * |
||
| 416 | * @return string|null The formatted date or NULL if the date is not valid |
||
| 417 | * @throws \InvalidArgumentException Is thrown, if the passed can not be formatted according to the configured date format |
||
| 418 | */ |
||
| 419 | public function formatDate($value) |
||
| 435 | |||
| 436 | /** |
||
| 437 | * Extracts the elements of the passed value by exploding them |
||
| 438 | * with the also passed delimiter. |
||
| 439 | * |
||
| 440 | * @param string $value The value to extract |
||
| 441 | * @param string|null $delimiter The delimiter used to extrace the elements |
||
| 442 | * |
||
| 443 | * @return array The exploded values |
||
| 444 | */ |
||
| 445 | public function explode($value, $delimiter = null) |
||
| 449 | |||
| 450 | /** |
||
| 451 | * Queries whether or not debug mode is enabled or not, default is FALSE. |
||
| 452 | * |
||
| 453 | * @return boolean TRUE if debug mode is enabled, else FALSE |
||
| 454 | */ |
||
| 455 | public function isDebugMode() |
||
| 459 | |||
| 460 | /** |
||
| 461 | * Queries whether or not strict mode is enabled or not, default is FALSE. |
||
| 462 | * |
||
| 463 | * @return boolean TRUE if strict mode is enabled, else FALSE |
||
| 464 | */ |
||
| 465 | public function isStrictMode() |
||
| 469 | |||
| 470 | /** |
||
| 471 | * Return's the subject's execution context configuration. |
||
| 472 | * |
||
| 473 | * @return \TechDivision\Import\Configuration\ExecutionContextInterface The execution context configuration to use |
||
| 474 | */ |
||
| 475 | public function getExecutionContext() |
||
| 479 | |||
| 480 | /** |
||
| 481 | * Set's the subject configuration. |
||
| 482 | * |
||
| 483 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $configuration The subject configuration |
||
| 484 | * |
||
| 485 | * @return void |
||
| 486 | */ |
||
| 487 | public function setConfiguration(SubjectConfigurationInterface $configuration) |
||
| 491 | |||
| 492 | /** |
||
| 493 | * Return's the subject configuration. |
||
| 494 | * |
||
| 495 | * @return \TechDivision\Import\Configuration\SubjectConfigurationInterface The subject configuration |
||
| 496 | */ |
||
| 497 | public function getConfiguration() |
||
| 501 | |||
| 502 | /** |
||
| 503 | * Set's the import adapter instance. |
||
| 504 | * |
||
| 505 | * @param \TechDivision\Import\Adapter\ImportAdapterInterface $importAdapter The import adapter instance |
||
| 506 | * |
||
| 507 | * @return void |
||
| 508 | */ |
||
| 509 | public function setImportAdapter(ImportAdapterInterface $importAdapter) |
||
| 513 | |||
| 514 | /** |
||
| 515 | * Return's the import adapter instance. |
||
| 516 | * |
||
| 517 | * @return \TechDivision\Import\Adapter\ImportAdapterInterface The import adapter instance |
||
| 518 | */ |
||
| 519 | public function getImportAdapter() |
||
| 523 | |||
| 524 | /** |
||
| 525 | * Return's the RegistryProcessor instance to handle the running threads. |
||
| 526 | * |
||
| 527 | * @return \TechDivision\Import\Services\RegistryProcessorInterface The registry processor instance |
||
| 528 | */ |
||
| 529 | public function getRegistryProcessor() |
||
| 533 | |||
| 534 | /** |
||
| 535 | * Set's the unique serial for this import process. |
||
| 536 | * |
||
| 537 | * @param string $serial The unique serial |
||
| 538 | * |
||
| 539 | * @return void |
||
| 540 | */ |
||
| 541 | public function setSerial($serial) |
||
| 545 | |||
| 546 | /** |
||
| 547 | * Return's the unique serial for this import process. |
||
| 548 | * |
||
| 549 | * @return string The unique serial |
||
| 550 | */ |
||
| 551 | public function getSerial() |
||
| 555 | |||
| 556 | /** |
||
| 557 | * Merge's the passed status into the actual one. |
||
| 558 | * |
||
| 559 | * @param array $status The status to MergeBuilder |
||
| 560 | * |
||
| 561 | * @return void |
||
| 562 | */ |
||
| 563 | public function mergeStatus(array $status) |
||
| 567 | |||
| 568 | /** |
||
| 569 | * Retur's the actual status. |
||
| 570 | * |
||
| 571 | * @return array The actual status |
||
| 572 | */ |
||
| 573 | public function getStatus() |
||
| 577 | |||
| 578 | /** |
||
| 579 | * Return's the unique identifier for the actual invocation. |
||
| 580 | * |
||
| 581 | * @return string The unique identifier |
||
| 582 | */ |
||
| 583 | public function getUniqueId() |
||
| 587 | |||
| 588 | /** |
||
| 589 | * Return's the source date format to use. |
||
| 590 | * |
||
| 591 | * @return string The source date format |
||
| 592 | */ |
||
| 593 | public function getSourceDateFormat() |
||
| 597 | |||
| 598 | /** |
||
| 599 | * Return's the multiple field delimiter character to use, default value is comma (,). |
||
| 600 | * |
||
| 601 | * @return string The multiple field delimiter character |
||
| 602 | */ |
||
| 603 | public function getMultipleFieldDelimiter() |
||
| 607 | |||
| 608 | /** |
||
| 609 | * Return's the multiple value delimiter character to use, default value is comma (|). |
||
| 610 | * |
||
| 611 | * @return string The multiple value delimiter character |
||
| 612 | */ |
||
| 613 | public function getMultipleValueDelimiter() |
||
| 617 | |||
| 618 | /** |
||
| 619 | * Intializes the previously loaded global data for exactly one bunch. |
||
| 620 | * |
||
| 621 | * @param string $serial The serial of the actual import |
||
| 622 | * |
||
| 623 | * @return void |
||
| 624 | */ |
||
| 625 | public function setUp($serial) |
||
| 685 | |||
| 686 | /** |
||
| 687 | * Clean up the global data after importing the variants. |
||
| 688 | * |
||
| 689 | * @param string $serial The serial of the actual import |
||
| 690 | * |
||
| 691 | * @return void |
||
| 692 | */ |
||
| 693 | public function tearDown($serial) |
||
| 723 | |||
| 724 | /** |
||
| 725 | * Return's the target directory for the artefact export. |
||
| 726 | * |
||
| 727 | * @return string The target directory for the artefact export |
||
| 728 | */ |
||
| 729 | View Code Duplication | public function getTargetDir() |
|
| 743 | |||
| 744 | /** |
||
| 745 | * Register the passed observer with the specific type. |
||
| 746 | * |
||
| 747 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer to register |
||
| 748 | * @param string $type The type to register the observer with |
||
| 749 | * |
||
| 750 | * @return void |
||
| 751 | */ |
||
| 752 | public function registerObserver(ObserverInterface $observer, $type) |
||
| 764 | |||
| 765 | /** |
||
| 766 | * Register the passed callback with the specific type. |
||
| 767 | * |
||
| 768 | * @param \TechDivision\Import\Callbacks\CallbackInterface $callback The subject to register the callbacks for |
||
| 769 | * @param string $type The type to register the callback with |
||
| 770 | * |
||
| 771 | * @return void |
||
| 772 | */ |
||
| 773 | public function registerCallback(CallbackInterface $callback, $type) |
||
| 785 | |||
| 786 | /** |
||
| 787 | * Return's the array with callbacks for the passed type. |
||
| 788 | * |
||
| 789 | * @param string $type The type of the callbacks to return |
||
| 790 | * |
||
| 791 | * @return array The callbacks |
||
| 792 | */ |
||
| 793 | public function getCallbacksByType($type) |
||
| 807 | |||
| 808 | /** |
||
| 809 | * Return's the array with the available observers. |
||
| 810 | * |
||
| 811 | * @return array The observers |
||
| 812 | */ |
||
| 813 | public function getObservers() |
||
| 817 | |||
| 818 | /** |
||
| 819 | * Return's the array with the available callbacks. |
||
| 820 | * |
||
| 821 | * @return array The callbacks |
||
| 822 | */ |
||
| 823 | public function getCallbacks() |
||
| 827 | |||
| 828 | /** |
||
| 829 | * Return's the callback mappings for this subject. |
||
| 830 | * |
||
| 831 | * @return array The array with the subject's callback mappings |
||
| 832 | */ |
||
| 833 | public function getCallbackMappings() |
||
| 837 | |||
| 838 | /** |
||
| 839 | * Imports the content of the file with the passed filename. |
||
| 840 | * |
||
| 841 | * |
||
| 842 | * @param string $serial The serial of the actual import |
||
| 843 | * @param string $filename The filename to process |
||
| 844 | * |
||
| 845 | * @return void |
||
| 846 | * @throws \Exception Is thrown, if the import can't be processed |
||
| 847 | */ |
||
| 848 | public function import($serial, $filename) |
||
| 976 | |||
| 977 | /** |
||
| 978 | * Imports the passed row into the database. If the import failed, the exception |
||
| 979 | * will be catched and logged, but the import process will be continued. |
||
| 980 | * |
||
| 981 | * @param array $row The row with the data to be imported |
||
| 982 | * |
||
| 983 | * @return void |
||
| 984 | */ |
||
| 985 | public function importRow(array $row) |
||
| 1093 | |||
| 1094 | /** |
||
| 1095 | * Queries whether or not that the subject needs an OK file to be processed. |
||
| 1096 | * |
||
| 1097 | * @return boolean TRUE if the subject needs an OK file, else FALSE |
||
| 1098 | */ |
||
| 1099 | public function isOkFileNeeded() |
||
| 1103 | |||
| 1104 | /** |
||
| 1105 | * Return's the default store. |
||
| 1106 | * |
||
| 1107 | * @return array The default store |
||
| 1108 | */ |
||
| 1109 | public function getDefaultStore() |
||
| 1113 | |||
| 1114 | /** |
||
| 1115 | * Return's the default store view code. |
||
| 1116 | * |
||
| 1117 | * @return array The default store view code |
||
| 1118 | */ |
||
| 1119 | public function getDefaultStoreViewCode() |
||
| 1123 | |||
| 1124 | /** |
||
| 1125 | * Set's the store view code the create the product/attributes for. |
||
| 1126 | * |
||
| 1127 | * @param string $storeViewCode The store view code |
||
| 1128 | * |
||
| 1129 | * @return void |
||
| 1130 | */ |
||
| 1131 | public function setStoreViewCode($storeViewCode) |
||
| 1135 | |||
| 1136 | /** |
||
| 1137 | * Return's the store view code the create the product/attributes for. |
||
| 1138 | * |
||
| 1139 | * @param string|null $default The default value to return, if the store view code has not been set |
||
| 1140 | * |
||
| 1141 | * @return string The store view code |
||
| 1142 | */ |
||
| 1143 | public function getStoreViewCode($default = null) |
||
| 1160 | |||
| 1161 | /** |
||
| 1162 | * Prepare's the store view code in the subject. If the store_view_code row doesn't contain |
||
| 1163 | * any value, the default code of the default store view will be set. |
||
| 1164 | * |
||
| 1165 | * @return void |
||
| 1166 | */ |
||
| 1167 | public function prepareStoreViewCode() |
||
| 1178 | |||
| 1179 | /** |
||
| 1180 | * Return's the store ID of the store with the passed store view code |
||
| 1181 | * |
||
| 1182 | * @param string $storeViewCode The store view code to return the store ID for |
||
| 1183 | * |
||
| 1184 | * @return integer The ID of the store with the passed ID |
||
| 1185 | * @throws \Exception Is thrown, if the store with the actual code is not available |
||
| 1186 | */ |
||
| 1187 | public function getStoreId($storeViewCode) |
||
| 1205 | |||
| 1206 | /** |
||
| 1207 | * Return's the store ID of the actual row, or of the default store |
||
| 1208 | * if no store view code is set in the CSV file. |
||
| 1209 | * |
||
| 1210 | * @param string|null $default The default store view code to use, if no store view code is set in the CSV file |
||
| 1211 | * |
||
| 1212 | * @return integer The ID of the actual store |
||
| 1213 | * @throws \Exception Is thrown, if the store with the actual code is not available |
||
| 1214 | */ |
||
| 1215 | public function getRowStoreId($default = null) |
||
| 1226 | |||
| 1227 | /** |
||
| 1228 | * Return's the root category for the actual view store. |
||
| 1229 | * |
||
| 1230 | * @return array The store's root category |
||
| 1231 | * @throws \Exception Is thrown if the root category for the passed store code is NOT available |
||
| 1232 | */ |
||
| 1233 | public function getRootCategory() |
||
| 1247 | |||
| 1248 | /** |
||
| 1249 | * Return's the array with the root categories. |
||
| 1250 | * |
||
| 1251 | * @return array The array with the root categories |
||
| 1252 | */ |
||
| 1253 | public function getRootCategories() |
||
| 1257 | |||
| 1258 | /** |
||
| 1259 | * Return's the Magento configuration value. |
||
| 1260 | * |
||
| 1261 | * @param string $path The Magento path of the requested configuration value |
||
| 1262 | * @param mixed $default The default value that has to be returned, if the requested configuration value is not set |
||
| 1263 | * @param string $scope The scope the configuration value has been set |
||
| 1264 | * @param integer $scopeId The scope ID the configuration value has been set |
||
| 1265 | * |
||
| 1266 | * @return mixed The configuration value |
||
| 1267 | * @throws \Exception Is thrown, if nor a value can be found or a default value has been passed |
||
| 1268 | * @deprecated Since version 17.x, use TechDivision\Import\Loaders\CoreConfigDataLoader::load() method instead |
||
| 1269 | */ |
||
| 1270 | View Code Duplication | public function getCoreConfigData($path, $default = null, $scope = ScopeKeys::SCOPE_DEFAULT, $scopeId = 0) |
|
| 1346 | |||
| 1347 | /** |
||
| 1348 | * Resolve the original column name for the passed one. |
||
| 1349 | * |
||
| 1350 | * @param string $columnName The column name that has to be resolved |
||
| 1351 | * |
||
| 1352 | * @return string|null The original column name |
||
| 1353 | */ |
||
| 1354 | public function resolveOriginalColumnName($columnName) |
||
| 1376 | |||
| 1377 | /** |
||
| 1378 | * Return's the original data if available, or an empty array. |
||
| 1379 | * |
||
| 1380 | * @return array The original data |
||
| 1381 | */ |
||
| 1382 | public function getOriginalData() |
||
| 1397 | |||
| 1398 | /** |
||
| 1399 | * Query's whether or not the actual column contains original data like |
||
| 1400 | * filename, line number and column names. |
||
| 1401 | * |
||
| 1402 | * @return boolean TRUE if the actual column contains origin data, else FALSE |
||
| 1403 | */ |
||
| 1404 | public function hasOriginalData() |
||
| 1408 | |||
| 1409 | /** |
||
| 1410 | * Wraps the passed exeception into a new one by trying to resolve the original filname, |
||
| 1411 | * line number and column names and use it for a detailed exception message. |
||
| 1412 | * |
||
| 1413 | * @param array $columnNames The column names that should be resolved and wrapped |
||
| 1414 | * @param \Exception $parent The exception we want to wrap |
||
| 1415 | * @param string $className The class name of the exception type we want to wrap the parent one |
||
| 1416 | * |
||
| 1417 | * @return \Exception the wrapped exception |
||
| 1418 | */ |
||
| 1419 | public function wrapException( |
||
| 1463 | |||
| 1464 | /** |
||
| 1465 | * Strip's the exception suffix containing filename and line number from the |
||
| 1466 | * passed message. |
||
| 1467 | * |
||
| 1468 | * @param string $message The message to strip the exception suffix from |
||
| 1469 | * |
||
| 1470 | * @return mixed The message without the exception suffix |
||
| 1471 | */ |
||
| 1472 | public function stripExceptionSuffix($message) |
||
| 1476 | |||
| 1477 | /** |
||
| 1478 | * Append's the exception suffix containing filename and line number to the |
||
| 1479 | * passed message. If no message has been passed, only the suffix will be |
||
| 1480 | * returned |
||
| 1481 | * |
||
| 1482 | * @param string|null $message The message to append the exception suffix to |
||
| 1483 | * @param string|null $filename The filename used to create the suffix |
||
| 1484 | * @param string|null $lineNumber The line number used to create the suffx |
||
| 1485 | * |
||
| 1486 | * @return string The message with the appended exception suffix |
||
| 1487 | */ |
||
| 1488 | public function appendExceptionSuffix($message = null, $filename = null, $lineNumber = null) |
||
| 1509 | |||
| 1510 | /** |
||
| 1511 | * Raises the value for the counter with the passed key by one. |
||
| 1512 | * |
||
| 1513 | * @param mixed $counterName The name of the counter to raise |
||
| 1514 | * |
||
| 1515 | * @return integer The counter's new value |
||
| 1516 | */ |
||
| 1517 | public function raiseCounter($counterName) |
||
| 1526 | |||
| 1527 | /** |
||
| 1528 | * Merge the passed array into the status of the actual import. |
||
| 1529 | * |
||
| 1530 | * @param array $status The status information to be merged |
||
| 1531 | * |
||
| 1532 | * @return void |
||
| 1533 | */ |
||
| 1534 | public function mergeAttributesRecursive(array $status) |
||
| 1543 | |||
| 1544 | /** |
||
| 1545 | * Return's the entity type code to be used. |
||
| 1546 | * |
||
| 1547 | * @return string The entity type code to be used |
||
| 1548 | */ |
||
| 1549 | public function getEntityTypeCode() |
||
| 1563 | |||
| 1564 | /** |
||
| 1565 | * Concatenates and returns the event name for the actual plugin and subject context. |
||
| 1566 | * |
||
| 1567 | * @param string $eventName The event name to concatenate |
||
| 1568 | * |
||
| 1569 | * @return string The concatenated event name |
||
| 1570 | */ |
||
| 1571 | protected function getEventName($eventName) |
||
| 1580 | |||
| 1581 | /** |
||
| 1582 | * Return's the full opration name, which consists of the Magento edition, the entity type code and the operation name. |
||
| 1583 | * |
||
| 1584 | * @param string $separator The separator used to seperate the elements |
||
| 1585 | * |
||
| 1586 | * @return string The full operation name |
||
| 1587 | */ |
||
| 1588 | public function getFullOperationName($separator = '/') |
||
| 1592 | } |
||
| 1593 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..