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 | * @throws \InvalidArgumentException Is thrown, if the passed can not be formatted according to the configured date format | ||
| 416 | */ | ||
| 417 | public function formatDate($value) | ||
| 433 | |||
| 434 | /** | ||
| 435 | * Extracts the elements of the passed value by exploding them | ||
| 436 | * with the also passed delimiter. | ||
| 437 | * | ||
| 438 | * @param string $value The value to extract | ||
| 439 | * @param string|null $delimiter The delimiter used to extrace the elements | ||
| 440 | * | ||
| 441 | * @return array The exploded values | ||
| 442 | */ | ||
| 443 | public function explode($value, $delimiter = null) | ||
| 447 | |||
| 448 | /** | ||
| 449 | * Queries whether or not debug mode is enabled or not, default is TRUE. | ||
| 450 | * | ||
| 451 | * @return boolean TRUE if debug mode is enabled, else FALSE | ||
| 452 | */ | ||
| 453 | 1 | public function isDebugMode() | |
| 457 | |||
| 458 | /** | ||
| 459 | * Return's the subject's execution context configuration. | ||
| 460 | * | ||
| 461 | * @return \TechDivision\Import\ExecutionContextInterface The execution context configuration to use | ||
| 462 | */ | ||
| 463 | public function getExecutionContext() | ||
| 467 | |||
| 468 | /** | ||
| 469 | * Set's the subject configuration. | ||
| 470 | * | ||
| 471 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $configuration The subject configuration | ||
| 472 | * | ||
| 473 | * @return void | ||
| 474 | */ | ||
| 475 | 81 | public function setConfiguration(SubjectConfigurationInterface $configuration) | |
| 479 | |||
| 480 | /** | ||
| 481 | * Return's the subject configuration. | ||
| 482 | * | ||
| 483 | * @return \TechDivision\Import\Configuration\SubjectConfigurationInterface The subject configuration | ||
| 484 | */ | ||
| 485 | 81 | public function getConfiguration() | |
| 489 | |||
| 490 | /** | ||
| 491 | * Set's the import adapter instance. | ||
| 492 | * | ||
| 493 | * @param \TechDivision\Import\Adapter\ImportAdapterInterface $importAdapter The import adapter instance | ||
| 494 | * | ||
| 495 | * @return void | ||
| 496 | */ | ||
| 497 | 1 | public function setImportAdapter(ImportAdapterInterface $importAdapter) | |
| 501 | |||
| 502 | /** | ||
| 503 | * Return's the import adapter instance. | ||
| 504 | * | ||
| 505 | * @return \TechDivision\Import\Adapter\ImportAdapterInterface The import adapter instance | ||
| 506 | */ | ||
| 507 | 1 | public function getImportAdapter() | |
| 511 | |||
| 512 | /** | ||
| 513 | * Return's the RegistryProcessor instance to handle the running threads. | ||
| 514 | * | ||
| 515 | * @return \TechDivision\Import\Services\RegistryProcessorInterface The registry processor instance | ||
| 516 | */ | ||
| 517 | 81 | public function getRegistryProcessor() | |
| 521 | |||
| 522 | /** | ||
| 523 | * Set's the unique serial for this import process. | ||
| 524 | * | ||
| 525 | * @param string $serial The unique serial | ||
| 526 | * | ||
| 527 | * @return void | ||
| 528 | */ | ||
| 529 | 8 | public function setSerial($serial) | |
| 533 | |||
| 534 | /** | ||
| 535 | * Return's the unique serial for this import process. | ||
| 536 | * | ||
| 537 | * @return string The unique serial | ||
| 538 | */ | ||
| 539 | 1 | public function getSerial() | |
| 543 | |||
| 544 | /** | ||
| 545 | * Merge's the passed status into the actual one. | ||
| 546 | * | ||
| 547 | * @param array $status The status to MergeBuilder | ||
| 548 | * | ||
| 549 | * @return void | ||
| 550 | */ | ||
| 551 | 4 | public function mergeStatus(array $status) | |
| 555 | |||
| 556 | /** | ||
| 557 | * Retur's the actual status. | ||
| 558 | * | ||
| 559 | * @return array The actual status | ||
| 560 | */ | ||
| 561 | public function getStatus() | ||
| 565 | |||
| 566 | /** | ||
| 567 | * Return's the unique identifier for the actual invocation. | ||
| 568 | * | ||
| 569 | * @return string The unique identifier | ||
| 570 | */ | ||
| 571 | 4 | public function getUniqueId() | |
| 575 | |||
| 576 | /** | ||
| 577 | * Return's the source date format to use. | ||
| 578 | * | ||
| 579 | * @return string The source date format | ||
| 580 | */ | ||
| 581 | public function getSourceDateFormat() | ||
| 585 | |||
| 586 | /** | ||
| 587 | * Return's the multiple field delimiter character to use, default value is comma (,). | ||
| 588 | * | ||
| 589 | * @return string The multiple field delimiter character | ||
| 590 | */ | ||
| 591 | 1 | public function getMultipleFieldDelimiter() | |
| 595 | |||
| 596 | /** | ||
| 597 | * Return's the multiple value delimiter character to use, default value is comma (|). | ||
| 598 | * | ||
| 599 | * @return string The multiple value delimiter character | ||
| 600 | */ | ||
| 601 | 1 | public function getMultipleValueDelimiter() | |
| 605 | |||
| 606 | /** | ||
| 607 | * Intializes the previously loaded global data for exactly one bunch. | ||
| 608 | * | ||
| 609 | * @param string $serial The serial of the actual import | ||
| 610 | * | ||
| 611 | * @return void | ||
| 612 | */ | ||
| 613 | 81 | public function setUp($serial) | |
| 659 | |||
| 660 | /** | ||
| 661 | * Clean up the global data after importing the variants. | ||
| 662 | * | ||
| 663 | * @param string $serial The serial of the actual import | ||
| 664 | * | ||
| 665 | * @return void | ||
| 666 | */ | ||
| 667 | 1 | public function tearDown($serial) | |
| 683 | |||
| 684 | /** | ||
| 685 | * Return's the target directory for the artefact export. | ||
| 686 | * | ||
| 687 | * @return string The target directory for the artefact export | ||
| 688 | */ | ||
| 689 | 1 | View Code Duplication | public function getTargetDir() | 
| 703 | |||
| 704 | /** | ||
| 705 | * Register the passed observer with the specific type. | ||
| 706 | * | ||
| 707 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer to register | ||
| 708 | * @param string $type The type to register the observer with | ||
| 709 | * | ||
| 710 | * @return void | ||
| 711 | */ | ||
| 712 | 6 | public function registerObserver(ObserverInterface $observer, $type) | |
| 724 | |||
| 725 | /** | ||
| 726 | * Register the passed callback with the specific type. | ||
| 727 | * | ||
| 728 | * @param \TechDivision\Import\Callbacks\CallbackInterface $callback The subject to register the callbacks for | ||
| 729 | * @param string $type The type to register the callback with | ||
| 730 | * | ||
| 731 | * @return void | ||
| 732 | */ | ||
| 733 | 2 | public function registerCallback(CallbackInterface $callback, $type) | |
| 745 | |||
| 746 | /** | ||
| 747 | * Return's the array with callbacks for the passed type. | ||
| 748 | * | ||
| 749 | * @param string $type The type of the callbacks to return | ||
| 750 | * | ||
| 751 | * @return array The callbacks | ||
| 752 | */ | ||
| 753 | 1 | public function getCallbacksByType($type) | |
| 767 | |||
| 768 | /** | ||
| 769 | * Return's the array with the available observers. | ||
| 770 | * | ||
| 771 | * @return array The observers | ||
| 772 | */ | ||
| 773 | 6 | public function getObservers() | |
| 777 | |||
| 778 | /** | ||
| 779 | * Return's the array with the available callbacks. | ||
| 780 | * | ||
| 781 | * @return array The callbacks | ||
| 782 | */ | ||
| 783 | 1 | public function getCallbacks() | |
| 787 | |||
| 788 | /** | ||
| 789 | * Return's the callback mappings for this subject. | ||
| 790 | * | ||
| 791 | * @return array The array with the subject's callback mappings | ||
| 792 | */ | ||
| 793 | 2 | public function getCallbackMappings() | |
| 797 | |||
| 798 | /** | ||
| 799 | * Imports the content of the file with the passed filename. | ||
| 800 | * | ||
| 801 | * | ||
| 802 | * @param string $serial The serial of the actual import | ||
| 803 | * @param string $filename The filename to process | ||
| 804 | * | ||
| 805 | * @return void | ||
| 806 | * @throws \Exception Is thrown, if the import can't be processed | ||
| 807 | */ | ||
| 808 | 2 | public function import($serial, $filename) | |
| 926 | |||
| 927 | /** | ||
| 928 | * Imports the passed row into the database. If the import failed, the exception | ||
| 929 | * will be catched and logged, but the import process will be continued. | ||
| 930 | * | ||
| 931 | * @param array $row The row with the data to be imported | ||
| 932 | * | ||
| 933 | * @return void | ||
| 934 | */ | ||
| 935 | 7 | public function importRow(array $row) | |
| 1043 | |||
| 1044 | /** | ||
| 1045 | * Queries whether or not that the subject needs an OK file to be processed. | ||
| 1046 | * | ||
| 1047 | * @return boolean TRUE if the subject needs an OK file, else FALSE | ||
| 1048 | */ | ||
| 1049 | 1 | public function isOkFileNeeded() | |
| 1053 | |||
| 1054 | /** | ||
| 1055 | * Return's the default store. | ||
| 1056 | * | ||
| 1057 | * @return array The default store | ||
| 1058 | */ | ||
| 1059 | public function getDefaultStore() | ||
| 1063 | |||
| 1064 | /** | ||
| 1065 | * Return's the default store view code. | ||
| 1066 | * | ||
| 1067 | * @return array The default store view code | ||
| 1068 | */ | ||
| 1069 | 5 | public function getDefaultStoreViewCode() | |
| 1073 | |||
| 1074 | /** | ||
| 1075 | * Set's the store view code the create the product/attributes for. | ||
| 1076 | * | ||
| 1077 | * @param string $storeViewCode The store view code | ||
| 1078 | * | ||
| 1079 | * @return void | ||
| 1080 | */ | ||
| 1081 | 4 | public function setStoreViewCode($storeViewCode) | |
| 1085 | |||
| 1086 | /** | ||
| 1087 | * Return's the store view code the create the product/attributes for. | ||
| 1088 | * | ||
| 1089 | * @param string|null $default The default value to return, if the store view code has not been set | ||
| 1090 | * | ||
| 1091 | * @return string The store view code | ||
| 1092 | */ | ||
| 1093 | 8 | public function getStoreViewCode($default = null) | |
| 1110 | |||
| 1111 | /** | ||
| 1112 | * Prepare's the store view code in the subject. If the store_view_code row doesn't contain | ||
| 1113 | * any value, the default code of the default store view will be set. | ||
| 1114 | * | ||
| 1115 | * @return void | ||
| 1116 | */ | ||
| 1117 | 2 | public function prepareStoreViewCode() | |
| 1128 | |||
| 1129 | /** | ||
| 1130 | * Return's the store ID of the store with the passed store view code | ||
| 1131 | * | ||
| 1132 | * @param string $storeViewCode The store view code to return the store ID for | ||
| 1133 | * | ||
| 1134 | * @return integer The ID of the store with the passed ID | ||
| 1135 | * @throws \Exception Is thrown, if the store with the actual code is not available | ||
| 1136 | */ | ||
| 1137 | 4 | public function getStoreId($storeViewCode) | |
| 1155 | |||
| 1156 | /** | ||
| 1157 | * Return's the store ID of the actual row, or of the default store | ||
| 1158 | * if no store view code is set in the CSV file. | ||
| 1159 | * | ||
| 1160 | * @param string|null $default The default store view code to use, if no store view code is set in the CSV file | ||
| 1161 | * | ||
| 1162 | * @return integer The ID of the actual store | ||
| 1163 | * @throws \Exception Is thrown, if the store with the actual code is not available | ||
| 1164 | */ | ||
| 1165 | 2 | public function getRowStoreId($default = null) | |
| 1176 | |||
| 1177 | /** | ||
| 1178 | * Return's the root category for the actual view store. | ||
| 1179 | * | ||
| 1180 | * @return array The store's root category | ||
| 1181 | * @throws \Exception Is thrown if the root category for the passed store code is NOT available | ||
| 1182 | */ | ||
| 1183 | 2 | public function getRootCategory() | |
| 1197 | |||
| 1198 | /** | ||
| 1199 | * Return's the Magento configuration value. | ||
| 1200 | * | ||
| 1201 | * @param string $path The Magento path of the requested configuration value | ||
| 1202 | * @param mixed $default The default value that has to be returned, if the requested configuration value is not set | ||
| 1203 | * @param string $scope The scope the configuration value has been set | ||
| 1204 | * @param integer $scopeId The scope ID the configuration value has been set | ||
| 1205 | * | ||
| 1206 | * @return mixed The configuration value | ||
| 1207 | * @throws \Exception Is thrown, if nor a value can be found or a default value has been passed | ||
| 1208 | */ | ||
| 1209 | 5 | public function getCoreConfigData($path, $default = null, $scope = ScopeKeys::SCOPE_DEFAULT, $scopeId = 0) | |
| 1285 | |||
| 1286 | /** | ||
| 1287 | * Resolve the original column name for the passed one. | ||
| 1288 | * | ||
| 1289 | * @param string $columnName The column name that has to be resolved | ||
| 1290 | * | ||
| 1291 | * @return string|null The original column name | ||
| 1292 | */ | ||
| 1293 | 2 | public function resolveOriginalColumnName($columnName) | |
| 1315 | |||
| 1316 | /** | ||
| 1317 | * Return's the original data if available, or an empty array. | ||
| 1318 | * | ||
| 1319 | * @return array The original data | ||
| 1320 | */ | ||
| 1321 | 2 | public function getOriginalData() | |
| 1336 | |||
| 1337 | /** | ||
| 1338 | * Query's whether or not the actual column contains original data like | ||
| 1339 | * filename, line number and column names. | ||
| 1340 | * | ||
| 1341 | * @return boolean TRUE if the actual column contains origin data, else FALSE | ||
| 1342 | */ | ||
| 1343 | 2 | public function hasOriginalData() | |
| 1347 | |||
| 1348 | /** | ||
| 1349 | * Wraps the passed exeception into a new one by trying to resolve the original filname, | ||
| 1350 | * line number and column names and use it for a detailed exception message. | ||
| 1351 | * | ||
| 1352 | * @param array $columnNames The column names that should be resolved and wrapped | ||
| 1353 | * @param \Exception $parent The exception we want to wrap | ||
| 1354 | * @param string $className The class name of the exception type we want to wrap the parent one | ||
| 1355 | * | ||
| 1356 | * @return \Exception the wrapped exception | ||
| 1357 | */ | ||
| 1358 | 1 | public function wrapException( | |
| 1402 | |||
| 1403 | /** | ||
| 1404 | * Strip's the exception suffix containing filename and line number from the | ||
| 1405 | * passed message. | ||
| 1406 | * | ||
| 1407 | * @param string $message The message to strip the exception suffix from | ||
| 1408 | * | ||
| 1409 | * @return mixed The message without the exception suffix | ||
| 1410 | */ | ||
| 1411 | 1 | public function stripExceptionSuffix($message) | |
| 1415 | |||
| 1416 | /** | ||
| 1417 | * Append's the exception suffix containing filename and line number to the | ||
| 1418 | * passed message. If no message has been passed, only the suffix will be | ||
| 1419 | * returned | ||
| 1420 | * | ||
| 1421 | * @param string|null $message The message to append the exception suffix to | ||
| 1422 | * @param string|null $filename The filename used to create the suffix | ||
| 1423 | * @param string|null $lineNumber The line number used to create the suffx | ||
| 1424 | * | ||
| 1425 | * @return string The message with the appended exception suffix | ||
| 1426 | */ | ||
| 1427 | 12 | public function appendExceptionSuffix($message = null, $filename = null, $lineNumber = null) | |
| 1448 | |||
| 1449 | /** | ||
| 1450 | * Raises the value for the counter with the passed key by one. | ||
| 1451 | * | ||
| 1452 | * @param mixed $counterName The name of the counter to raise | ||
| 1453 | * | ||
| 1454 | * @return integer The counter's new value | ||
| 1455 | */ | ||
| 1456 | 1 | public function raiseCounter($counterName) | |
| 1465 | |||
| 1466 | /** | ||
| 1467 | * Merge the passed array into the status of the actual import. | ||
| 1468 | * | ||
| 1469 | * @param array $status The status information to be merged | ||
| 1470 | * | ||
| 1471 | * @return void | ||
| 1472 | */ | ||
| 1473 | 1 | public function mergeAttributesRecursive(array $status) | |
| 1482 | |||
| 1483 | /** | ||
| 1484 | * Return's the entity type code to be used. | ||
| 1485 | * | ||
| 1486 | * @return string The entity type code to be used | ||
| 1487 | */ | ||
| 1488 | public function getEntityTypeCode() | ||
| 1502 | |||
| 1503 | /** | ||
| 1504 | * Concatenates and returns the event name for the actual plugin and subject context. | ||
| 1505 | * | ||
| 1506 | * @param string $eventName The event name to concatenate | ||
| 1507 | * | ||
| 1508 | * @return string The concatenated event name | ||
| 1509 | */ | ||
| 1510 | 9 | protected function getEventName($eventName) | |
| 1519 | |||
| 1520 | /** | ||
| 1521 | * Return's the full opration name, which consists of the Magento edition, the entity type code and the operation name. | ||
| 1522 | * | ||
| 1523 | * @param string $separator The separator used to seperate the elements | ||
| 1524 | * | ||
| 1525 | * @return string The full operation name | ||
| 1526 | */ | ||
| 1527 | public function getFullOperationName($separator = '/') | ||
| 1531 | } | ||
| 1532 | 
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..