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 |
||
| 52 | abstract class AbstractSubject implements SubjectInterface, FilesystemSubjectInterface, DateConverterSubjectInterface |
||
| 53 | { |
||
| 54 | |||
| 55 | /** |
||
| 56 | * The trait that provides basic filesystem handling functionality. |
||
| 57 | * |
||
| 58 | * @var \TechDivision\Import\Subjects\FilesystemTrait |
||
| 59 | */ |
||
| 60 | use FilesystemTrait; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * The trait that provides basic filesystem handling functionality. |
||
| 64 | * |
||
| 65 | * @var \TechDivision\Import\SystemLoggerTrait |
||
| 66 | */ |
||
| 67 | use SystemLoggerTrait; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * The trait that provides date converting functionality. |
||
| 71 | * |
||
| 72 | * @var \TechDivision\Import\DateConverterTrait |
||
| 73 | */ |
||
| 74 | use DateConverterTrait; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * The trait that provides header handling functionality. |
||
| 78 | * |
||
| 79 | * @var \TechDivision\Import\HeaderTrait |
||
| 80 | */ |
||
| 81 | use HeaderTrait; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * The trait that provides row handling functionality. |
||
| 85 | * |
||
| 86 | * @var \TechDivision\Import\RowTrait |
||
| 87 | */ |
||
| 88 | use RowTrait; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * The unique identifier for the actual invocation. |
||
| 92 | * |
||
| 93 | * @var string |
||
| 94 | */ |
||
| 95 | protected $uniqueId; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * The name of the file to be imported. |
||
| 99 | * |
||
| 100 | * @var string |
||
| 101 | */ |
||
| 102 | protected $filename; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * The actual line number. |
||
| 106 | * |
||
| 107 | * @var integer |
||
| 108 | */ |
||
| 109 | protected $lineNumber = 0; |
||
| 110 | |||
| 111 | /** |
||
| 112 | * The import adapter instance. |
||
| 113 | * |
||
| 114 | * @var \TechDivision\Import\Adapter\ImportAdapterInterface |
||
| 115 | */ |
||
| 116 | protected $importAdapter; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * The subject configuration. |
||
| 120 | * |
||
| 121 | * @var \TechDivision\Import\Configuration\SubjectConfigurationInterface |
||
| 122 | */ |
||
| 123 | protected $configuration; |
||
| 124 | |||
| 125 | /** |
||
| 126 | * The plugin configuration. |
||
| 127 | * |
||
| 128 | * @var \TechDivision\Import\Configuration\PluginConfigurationInterface |
||
| 129 | */ |
||
| 130 | protected $pluginConfiguration; |
||
| 131 | |||
| 132 | /** |
||
| 133 | * The RegistryProcessor instance to handle running threads. |
||
| 134 | * |
||
| 135 | * @var \TechDivision\Import\Services\RegistryProcessorInterface |
||
| 136 | */ |
||
| 137 | protected $registryProcessor; |
||
| 138 | |||
| 139 | /** |
||
| 140 | * The actions unique serial. |
||
| 141 | * |
||
| 142 | * @var string |
||
| 143 | */ |
||
| 144 | protected $serial; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * Array with the subject's observers. |
||
| 148 | * |
||
| 149 | * @var array |
||
| 150 | */ |
||
| 151 | protected $observers = array(); |
||
| 152 | |||
| 153 | /** |
||
| 154 | * Array with the subject's callbacks. |
||
| 155 | * |
||
| 156 | * @var array |
||
| 157 | */ |
||
| 158 | protected $callbacks = array(); |
||
| 159 | |||
| 160 | /** |
||
| 161 | * The subject's callback mappings. |
||
| 162 | * |
||
| 163 | * @var array |
||
| 164 | */ |
||
| 165 | protected $callbackMappings = array(); |
||
| 166 | |||
| 167 | /** |
||
| 168 | * The available root categories. |
||
| 169 | * |
||
| 170 | * @var array |
||
| 171 | */ |
||
| 172 | protected $rootCategories = array(); |
||
| 173 | |||
| 174 | /** |
||
| 175 | * The Magento configuration. |
||
| 176 | * |
||
| 177 | * @var array |
||
| 178 | */ |
||
| 179 | protected $coreConfigData = array(); |
||
| 180 | |||
| 181 | /** |
||
| 182 | * The available stores. |
||
| 183 | * |
||
| 184 | * @var array |
||
| 185 | */ |
||
| 186 | protected $stores = array(); |
||
| 187 | |||
| 188 | /** |
||
| 189 | * The available websites. |
||
| 190 | * |
||
| 191 | * @var array |
||
| 192 | */ |
||
| 193 | protected $storeWebsites = array(); |
||
| 194 | |||
| 195 | /** |
||
| 196 | * The default store. |
||
| 197 | * |
||
| 198 | * @var array |
||
| 199 | */ |
||
| 200 | protected $defaultStore; |
||
| 201 | |||
| 202 | /** |
||
| 203 | * The store view code the create the product/attributes for. |
||
| 204 | * |
||
| 205 | * @var string |
||
| 206 | */ |
||
| 207 | protected $storeViewCode; |
||
| 208 | |||
| 209 | /** |
||
| 210 | * The UID generator for the core config data. |
||
| 211 | * |
||
| 212 | * @var \TechDivision\Import\Utils\Generators\GeneratorInterface |
||
| 213 | */ |
||
| 214 | protected $coreConfigDataUidGenerator; |
||
| 215 | |||
| 216 | /** |
||
| 217 | * UNIX timestamp with the date the last row counter has been logged. |
||
| 218 | * |
||
| 219 | * @var integer |
||
| 220 | */ |
||
| 221 | protected $lastLog = 0; |
||
| 222 | |||
| 223 | /** |
||
| 224 | * The number of the last line that has been logged with the row counter |
||
| 225 | * @var integer |
||
| 226 | */ |
||
| 227 | protected $lastLineNumber = 0; |
||
| 228 | |||
| 229 | /** |
||
| 230 | * The event emitter instance. |
||
| 231 | * |
||
| 232 | * @var \League\Event\EmitterInterface |
||
| 233 | */ |
||
| 234 | protected $emitter; |
||
| 235 | |||
| 236 | /** |
||
| 237 | * The status of the file (0 = not processed, 1 = successfully processed, 2 = processed with failure) |
||
| 238 | * |
||
| 239 | * @var array |
||
| 240 | */ |
||
| 241 | protected $status = array(); |
||
| 242 | |||
| 243 | /** |
||
| 244 | * The default values for the columns from the configuration. |
||
| 245 | * |
||
| 246 | * @var array |
||
| 247 | */ |
||
| 248 | protected $defaultColumnValues = array(); |
||
| 249 | |||
| 250 | /** |
||
| 251 | * The values of the actual column, pre-initialized with the default values. |
||
| 252 | * |
||
| 253 | * @var array |
||
| 254 | */ |
||
| 255 | protected $columnValues = array(); |
||
| 256 | |||
| 257 | /** |
||
| 258 | * Mapping for the virtual entity type code to the real Magento 2 EAV entity type code. |
||
| 259 | * |
||
| 260 | * @var array |
||
| 261 | */ |
||
| 262 | protected $entityTypeCodeMappings = array( |
||
| 263 | EntityTypeCodes::EAV_ATTRIBUTE => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 264 | EntityTypeCodes::EAV_ATTRIBUTE_SET => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 265 | EntityTypeCodes::CATALOG_PRODUCT_URL => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 266 | EntityTypeCodes::CATALOG_PRODUCT_PRICE => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 267 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 268 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY_MSI => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 269 | EntityTypeCodes::CATALOG_PRODUCT_TIER_PRICE => EntityTypeCodes::CATALOG_PRODUCT |
||
| 270 | ); |
||
| 271 | |||
| 272 | /** |
||
| 273 | * Initialize the subject instance. |
||
| 274 | * |
||
| 275 | * @param \TechDivision\Import\Services\RegistryProcessorInterface $registryProcessor The registry processor instance |
||
| 276 | * @param \TechDivision\Import\Utils\Generators\GeneratorInterface $coreConfigDataUidGenerator The UID generator for the core config data |
||
| 277 | * @param \Doctrine\Common\Collections\Collection $systemLoggers The array with the system loggers instances |
||
| 278 | * @param \League\Event\EmitterInterface $emitter The event emitter instance |
||
| 279 | */ |
||
| 280 | 81 | public function __construct( |
|
| 291 | |||
| 292 | /** |
||
| 293 | * Return's the event emitter instance. |
||
| 294 | * |
||
| 295 | * @return \League\Event\EmitterInterface The event emitter instance |
||
| 296 | */ |
||
| 297 | 9 | public function getEmitter() |
|
| 301 | |||
| 302 | /** |
||
| 303 | * Set's the name of the file to import |
||
| 304 | * |
||
| 305 | * @param string $filename The filename |
||
| 306 | * |
||
| 307 | * @return void |
||
| 308 | */ |
||
| 309 | 13 | public function setFilename($filename) |
|
| 313 | |||
| 314 | /** |
||
| 315 | * Return's the name of the file to import. |
||
| 316 | * |
||
| 317 | * @return string The filename |
||
| 318 | */ |
||
| 319 | 12 | public function getFilename() |
|
| 323 | |||
| 324 | /** |
||
| 325 | * Set's the actual line number. |
||
| 326 | * |
||
| 327 | * @param integer $lineNumber The line number |
||
| 328 | * |
||
| 329 | * @return void |
||
| 330 | */ |
||
| 331 | 1 | public function setLineNumber($lineNumber) |
|
| 335 | |||
| 336 | /** |
||
| 337 | * Return's the actual line number. |
||
| 338 | * |
||
| 339 | * @return integer The line number |
||
| 340 | */ |
||
| 341 | 17 | public function getLineNumber() |
|
| 345 | |||
| 346 | /** |
||
| 347 | * Return's the default callback mappings. |
||
| 348 | * |
||
| 349 | * @return array The default callback mappings |
||
| 350 | */ |
||
| 351 | 1 | public function getDefaultCallbackMappings() |
|
| 355 | |||
| 356 | /** |
||
| 357 | * Load the default column values from the configuration. |
||
| 358 | * |
||
| 359 | * @return array The array with the default column values |
||
| 360 | */ |
||
| 361 | 81 | View Code Duplication | public function getDefaultColumnValues() |
| 381 | |||
| 382 | /** |
||
| 383 | * Load the default header mappings from the configuration. |
||
| 384 | * |
||
| 385 | * @return array The array with the default header mappings |
||
| 386 | */ |
||
| 387 | 81 | View Code Duplication | public function getDefaultHeaderMappings() |
| 407 | |||
| 408 | /** |
||
| 409 | * Tries to format the passed value to a valid date with format 'Y-m-d H:i:s'. |
||
| 410 | * If the passed value is NOT a valid date, NULL will be returned. |
||
| 411 | * |
||
| 412 | * @param string $value The value to format |
||
| 413 | * |
||
| 414 | * @return string|null The formatted date or NULL if the date is not valid |
||
| 415 | */ |
||
| 416 | public function formatDate($value) |
||
| 420 | |||
| 421 | /** |
||
| 422 | * Extracts the elements of the passed value by exploding them |
||
| 423 | * with the also passed delimiter. |
||
| 424 | * |
||
| 425 | * @param string $value The value to extract |
||
| 426 | * @param string|null $delimiter The delimiter used to extrace the elements |
||
| 427 | * |
||
| 428 | * @return array The exploded values |
||
| 429 | */ |
||
| 430 | public function explode($value, $delimiter = null) |
||
| 434 | |||
| 435 | /** |
||
| 436 | * Queries whether or not debug mode is enabled or not, default is TRUE. |
||
| 437 | * |
||
| 438 | * @return boolean TRUE if debug mode is enabled, else FALSE |
||
| 439 | */ |
||
| 440 | 1 | public function isDebugMode() |
|
| 444 | |||
| 445 | /** |
||
| 446 | * Return's the subject's execution context configuration. |
||
| 447 | * |
||
| 448 | * @return \TechDivision\Import\ExecutionContextInterface The execution context configuration to use |
||
| 449 | */ |
||
| 450 | public function getExecutionContext() |
||
| 454 | |||
| 455 | /** |
||
| 456 | * Set's the subject configuration. |
||
| 457 | * |
||
| 458 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $configuration The subject configuration |
||
| 459 | * |
||
| 460 | * @return void |
||
| 461 | */ |
||
| 462 | 81 | public function setConfiguration(SubjectConfigurationInterface $configuration) |
|
| 466 | |||
| 467 | /** |
||
| 468 | * Return's the subject configuration. |
||
| 469 | * |
||
| 470 | * @return \TechDivision\Import\Configuration\SubjectConfigurationInterface The subject configuration |
||
| 471 | */ |
||
| 472 | 81 | public function getConfiguration() |
|
| 476 | |||
| 477 | /** |
||
| 478 | * Set's the import adapter instance. |
||
| 479 | * |
||
| 480 | * @param \TechDivision\Import\Adapter\ImportAdapterInterface $importAdapter The import adapter instance |
||
| 481 | * |
||
| 482 | * @return void |
||
| 483 | */ |
||
| 484 | 1 | public function setImportAdapter(ImportAdapterInterface $importAdapter) |
|
| 488 | |||
| 489 | /** |
||
| 490 | * Return's the import adapter instance. |
||
| 491 | * |
||
| 492 | * @return \TechDivision\Import\Adapter\ImportAdapterInterface The import adapter instance |
||
| 493 | */ |
||
| 494 | 1 | public function getImportAdapter() |
|
| 498 | |||
| 499 | /** |
||
| 500 | * Return's the RegistryProcessor instance to handle the running threads. |
||
| 501 | * |
||
| 502 | * @return \TechDivision\Import\Services\RegistryProcessorInterface The registry processor instance |
||
| 503 | */ |
||
| 504 | 81 | public function getRegistryProcessor() |
|
| 508 | |||
| 509 | /** |
||
| 510 | * Set's the unique serial for this import process. |
||
| 511 | * |
||
| 512 | * @param string $serial The unique serial |
||
| 513 | * |
||
| 514 | * @return void |
||
| 515 | */ |
||
| 516 | 8 | public function setSerial($serial) |
|
| 520 | |||
| 521 | /** |
||
| 522 | * Return's the unique serial for this import process. |
||
| 523 | * |
||
| 524 | * @return string The unique serial |
||
| 525 | */ |
||
| 526 | 1 | public function getSerial() |
|
| 530 | |||
| 531 | /** |
||
| 532 | * Merge's the passed status into the actual one. |
||
| 533 | * |
||
| 534 | * @param array $status The status to MergeBuilder |
||
| 535 | * |
||
| 536 | * @return void |
||
| 537 | */ |
||
| 538 | 4 | public function mergeStatus(array $status) |
|
| 542 | |||
| 543 | /** |
||
| 544 | * Retur's the actual status. |
||
| 545 | * |
||
| 546 | * @return array The actual status |
||
| 547 | */ |
||
| 548 | public function getStatus() |
||
| 552 | |||
| 553 | /** |
||
| 554 | * Return's the unique identifier for the actual invocation. |
||
| 555 | * |
||
| 556 | * @return string The unique identifier |
||
| 557 | */ |
||
| 558 | 4 | public function getUniqueId() |
|
| 562 | |||
| 563 | /** |
||
| 564 | * Return's the source date format to use. |
||
| 565 | * |
||
| 566 | * @return string The source date format |
||
| 567 | */ |
||
| 568 | public function getSourceDateFormat() |
||
| 572 | |||
| 573 | /** |
||
| 574 | * Return's the multiple field delimiter character to use, default value is comma (,). |
||
| 575 | * |
||
| 576 | * @return string The multiple field delimiter character |
||
| 577 | */ |
||
| 578 | 1 | public function getMultipleFieldDelimiter() |
|
| 582 | |||
| 583 | /** |
||
| 584 | * Return's the multiple value delimiter character to use, default value is comma (|). |
||
| 585 | * |
||
| 586 | * @return string The multiple value delimiter character |
||
| 587 | */ |
||
| 588 | 1 | public function getMultipleValueDelimiter() |
|
| 592 | |||
| 593 | /** |
||
| 594 | * Intializes the previously loaded global data for exactly one bunch. |
||
| 595 | * |
||
| 596 | * @param string $serial The serial of the actual import |
||
| 597 | * |
||
| 598 | * @return void |
||
| 599 | */ |
||
| 600 | 81 | public function setUp($serial) |
|
| 646 | |||
| 647 | /** |
||
| 648 | * Clean up the global data after importing the variants. |
||
| 649 | * |
||
| 650 | * @param string $serial The serial of the actual import |
||
| 651 | * |
||
| 652 | * @return void |
||
| 653 | */ |
||
| 654 | 1 | public function tearDown($serial) |
|
| 670 | |||
| 671 | /** |
||
| 672 | * Return's the target directory for the artefact export. |
||
| 673 | * |
||
| 674 | * @return string The target directory for the artefact export |
||
| 675 | */ |
||
| 676 | 1 | View Code Duplication | public function getTargetDir() |
| 690 | |||
| 691 | /** |
||
| 692 | * Register the passed observer with the specific type. |
||
| 693 | * |
||
| 694 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer to register |
||
| 695 | * @param string $type The type to register the observer with |
||
| 696 | * |
||
| 697 | * @return void |
||
| 698 | */ |
||
| 699 | 6 | public function registerObserver(ObserverInterface $observer, $type) |
|
| 711 | |||
| 712 | /** |
||
| 713 | * Register the passed callback with the specific type. |
||
| 714 | * |
||
| 715 | * @param \TechDivision\Import\Callbacks\CallbackInterface $callback The subject to register the callbacks for |
||
| 716 | * @param string $type The type to register the callback with |
||
| 717 | * |
||
| 718 | * @return void |
||
| 719 | */ |
||
| 720 | 2 | public function registerCallback(CallbackInterface $callback, $type) |
|
| 732 | |||
| 733 | /** |
||
| 734 | * Return's the array with callbacks for the passed type. |
||
| 735 | * |
||
| 736 | * @param string $type The type of the callbacks to return |
||
| 737 | * |
||
| 738 | * @return array The callbacks |
||
| 739 | */ |
||
| 740 | 1 | public function getCallbacksByType($type) |
|
| 754 | |||
| 755 | /** |
||
| 756 | * Return's the array with the available observers. |
||
| 757 | * |
||
| 758 | * @return array The observers |
||
| 759 | */ |
||
| 760 | 6 | public function getObservers() |
|
| 764 | |||
| 765 | /** |
||
| 766 | * Return's the array with the available callbacks. |
||
| 767 | * |
||
| 768 | * @return array The callbacks |
||
| 769 | */ |
||
| 770 | 1 | public function getCallbacks() |
|
| 774 | |||
| 775 | /** |
||
| 776 | * Return's the callback mappings for this subject. |
||
| 777 | * |
||
| 778 | * @return array The array with the subject's callback mappings |
||
| 779 | */ |
||
| 780 | 2 | public function getCallbackMappings() |
|
| 784 | |||
| 785 | /** |
||
| 786 | * Imports the content of the file with the passed filename. |
||
| 787 | * |
||
| 788 | * |
||
| 789 | * @param string $serial The serial of the actual import |
||
| 790 | * @param string $filename The filename to process |
||
| 791 | * |
||
| 792 | * @return void |
||
| 793 | * @throws \Exception Is thrown, if the import can't be processed |
||
| 794 | */ |
||
| 795 | 2 | public function import($serial, $filename) |
|
| 913 | |||
| 914 | /** |
||
| 915 | * Imports the passed row into the database. If the import failed, the exception |
||
| 916 | * will be catched and logged, but the import process will be continued. |
||
| 917 | * |
||
| 918 | * @param array $row The row with the data to be imported |
||
| 919 | * |
||
| 920 | * @return void |
||
| 921 | */ |
||
| 922 | 7 | public function importRow(array $row) |
|
| 1030 | |||
| 1031 | /** |
||
| 1032 | * Queries whether or not that the subject needs an OK file to be processed. |
||
| 1033 | * |
||
| 1034 | * @return boolean TRUE if the subject needs an OK file, else FALSE |
||
| 1035 | */ |
||
| 1036 | 1 | public function isOkFileNeeded() |
|
| 1040 | |||
| 1041 | /** |
||
| 1042 | * Return's the default store. |
||
| 1043 | * |
||
| 1044 | * @return array The default store |
||
| 1045 | */ |
||
| 1046 | public function getDefaultStore() |
||
| 1050 | |||
| 1051 | /** |
||
| 1052 | * Return's the default store view code. |
||
| 1053 | * |
||
| 1054 | * @return array The default store view code |
||
| 1055 | */ |
||
| 1056 | 5 | public function getDefaultStoreViewCode() |
|
| 1060 | |||
| 1061 | /** |
||
| 1062 | * Set's the store view code the create the product/attributes for. |
||
| 1063 | * |
||
| 1064 | * @param string $storeViewCode The store view code |
||
| 1065 | * |
||
| 1066 | * @return void |
||
| 1067 | */ |
||
| 1068 | 4 | public function setStoreViewCode($storeViewCode) |
|
| 1072 | |||
| 1073 | /** |
||
| 1074 | * Return's the store view code the create the product/attributes for. |
||
| 1075 | * |
||
| 1076 | * @param string|null $default The default value to return, if the store view code has not been set |
||
| 1077 | * |
||
| 1078 | * @return string The store view code |
||
| 1079 | */ |
||
| 1080 | 8 | public function getStoreViewCode($default = null) |
|
| 1097 | |||
| 1098 | /** |
||
| 1099 | * Prepare's the store view code in the subject. If the store_view_code row doesn't contain |
||
| 1100 | * any value, the default code of the default store view will be set. |
||
| 1101 | * |
||
| 1102 | * @return void |
||
| 1103 | */ |
||
| 1104 | 2 | public function prepareStoreViewCode() |
|
| 1115 | |||
| 1116 | /** |
||
| 1117 | * Return's the store ID of the store with the passed store view code |
||
| 1118 | * |
||
| 1119 | * @param string $storeViewCode The store view code to return the store ID for |
||
| 1120 | * |
||
| 1121 | * @return integer The ID of the store with the passed ID |
||
| 1122 | * @throws \Exception Is thrown, if the store with the actual code is not available |
||
| 1123 | */ |
||
| 1124 | 4 | public function getStoreId($storeViewCode) |
|
| 1142 | |||
| 1143 | /** |
||
| 1144 | * Return's the store ID of the actual row, or of the default store |
||
| 1145 | * if no store view code is set in the CSV file. |
||
| 1146 | * |
||
| 1147 | * @param string|null $default The default store view code to use, if no store view code is set in the CSV file |
||
| 1148 | * |
||
| 1149 | * @return integer The ID of the actual store |
||
| 1150 | * @throws \Exception Is thrown, if the store with the actual code is not available |
||
| 1151 | */ |
||
| 1152 | 2 | public function getRowStoreId($default = null) |
|
| 1163 | |||
| 1164 | /** |
||
| 1165 | * Return's the root category for the actual view store. |
||
| 1166 | * |
||
| 1167 | * @return array The store's root category |
||
| 1168 | * @throws \Exception Is thrown if the root category for the passed store code is NOT available |
||
| 1169 | */ |
||
| 1170 | 2 | public function getRootCategory() |
|
| 1184 | |||
| 1185 | /** |
||
| 1186 | * Return's the Magento configuration value. |
||
| 1187 | * |
||
| 1188 | * @param string $path The Magento path of the requested configuration value |
||
| 1189 | * @param mixed $default The default value that has to be returned, if the requested configuration value is not set |
||
| 1190 | * @param string $scope The scope the configuration value has been set |
||
| 1191 | * @param integer $scopeId The scope ID the configuration value has been set |
||
| 1192 | * |
||
| 1193 | * @return mixed The configuration value |
||
| 1194 | * @throws \Exception Is thrown, if nor a value can be found or a default value has been passed |
||
| 1195 | */ |
||
| 1196 | 5 | public function getCoreConfigData($path, $default = null, $scope = ScopeKeys::SCOPE_DEFAULT, $scopeId = 0) |
|
| 1272 | |||
| 1273 | /** |
||
| 1274 | * Resolve the original column name for the passed one. |
||
| 1275 | * |
||
| 1276 | * @param string $columnName The column name that has to be resolved |
||
| 1277 | * |
||
| 1278 | * @return string|null The original column name |
||
| 1279 | */ |
||
| 1280 | 2 | public function resolveOriginalColumnName($columnName) |
|
| 1302 | |||
| 1303 | /** |
||
| 1304 | * Return's the original data if available, or an empty array. |
||
| 1305 | * |
||
| 1306 | * @return array The original data |
||
| 1307 | */ |
||
| 1308 | 2 | public function getOriginalData() |
|
| 1323 | |||
| 1324 | /** |
||
| 1325 | * Query's whether or not the actual column contains original data like |
||
| 1326 | * filename, line number and column names. |
||
| 1327 | * |
||
| 1328 | * @return boolean TRUE if the actual column contains origin data, else FALSE |
||
| 1329 | */ |
||
| 1330 | 2 | public function hasOriginalData() |
|
| 1334 | |||
| 1335 | /** |
||
| 1336 | * Wraps the passed exeception into a new one by trying to resolve the original filname, |
||
| 1337 | * line number and column names and use it for a detailed exception message. |
||
| 1338 | * |
||
| 1339 | * @param array $columnNames The column names that should be resolved and wrapped |
||
| 1340 | * @param \Exception $parent The exception we want to wrap |
||
| 1341 | * @param string $className The class name of the exception type we want to wrap the parent one |
||
| 1342 | * |
||
| 1343 | * @return \Exception the wrapped exception |
||
| 1344 | */ |
||
| 1345 | 1 | public function wrapException( |
|
| 1389 | |||
| 1390 | /** |
||
| 1391 | * Strip's the exception suffix containing filename and line number from the |
||
| 1392 | * passed message. |
||
| 1393 | * |
||
| 1394 | * @param string $message The message to strip the exception suffix from |
||
| 1395 | * |
||
| 1396 | * @return mixed The message without the exception suffix |
||
| 1397 | */ |
||
| 1398 | 1 | public function stripExceptionSuffix($message) |
|
| 1402 | |||
| 1403 | /** |
||
| 1404 | * Append's the exception suffix containing filename and line number to the |
||
| 1405 | * passed message. If no message has been passed, only the suffix will be |
||
| 1406 | * returned |
||
| 1407 | * |
||
| 1408 | * @param string|null $message The message to append the exception suffix to |
||
| 1409 | * @param string|null $filename The filename used to create the suffix |
||
| 1410 | * @param string|null $lineNumber The line number used to create the suffx |
||
| 1411 | * |
||
| 1412 | * @return string The message with the appended exception suffix |
||
| 1413 | */ |
||
| 1414 | 12 | public function appendExceptionSuffix($message = null, $filename = null, $lineNumber = null) |
|
| 1435 | |||
| 1436 | /** |
||
| 1437 | * Raises the value for the counter with the passed key by one. |
||
| 1438 | * |
||
| 1439 | * @param mixed $counterName The name of the counter to raise |
||
| 1440 | * |
||
| 1441 | * @return integer The counter's new value |
||
| 1442 | */ |
||
| 1443 | 1 | public function raiseCounter($counterName) |
|
| 1452 | |||
| 1453 | /** |
||
| 1454 | * Merge the passed array into the status of the actual import. |
||
| 1455 | * |
||
| 1456 | * @param array $status The status information to be merged |
||
| 1457 | * |
||
| 1458 | * @return void |
||
| 1459 | */ |
||
| 1460 | 1 | public function mergeAttributesRecursive(array $status) |
|
| 1469 | |||
| 1470 | /** |
||
| 1471 | * Return's the entity type code to be used. |
||
| 1472 | * |
||
| 1473 | * @return string The entity type code to be used |
||
| 1474 | */ |
||
| 1475 | public function getEntityTypeCode() |
||
| 1489 | |||
| 1490 | /** |
||
| 1491 | * Concatenates and returns the event name for the actual plugin and subject context. |
||
| 1492 | * |
||
| 1493 | * @param string $eventName The event name to concatenate |
||
| 1494 | * |
||
| 1495 | * @return string The concatenated event name |
||
| 1496 | */ |
||
| 1497 | 9 | protected function getEventName($eventName) |
|
| 1506 | |||
| 1507 | /** |
||
| 1508 | * Return's the full opration name, which consists of the Magento edition, the entity type code and the operation name. |
||
| 1509 | * |
||
| 1510 | * @param string $separator The separator used to seperate the elements |
||
| 1511 | * |
||
| 1512 | * @return string The full operation name |
||
| 1513 | */ |
||
| 1514 | public function getFullOperationName($separator = '/') |
||
| 1518 | } |
||
| 1519 |
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..