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 | * Mapping for the virtual entity type code to the real Magento 2 EAV entity type code. |
||
| 245 | * |
||
| 246 | * @var array |
||
| 247 | */ |
||
| 248 | protected $entityTypeCodeMappings = array( |
||
| 249 | EntityTypeCodes::EAV_ATTRIBUTE => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 250 | EntityTypeCodes::EAV_ATTRIBUTE_SET => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 251 | EntityTypeCodes::CATALOG_PRODUCT_PRICE => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 252 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 253 | EntityTypeCodes::CATALOG_PRODUCT_INVENTORY_MSI => EntityTypeCodes::CATALOG_PRODUCT, |
||
| 254 | EntityTypeCodes::CATALOG_PRODUCT_TIER_PRICE => EntityTypeCodes::CATALOG_PRODUCT |
||
| 255 | ); |
||
| 256 | |||
| 257 | /** |
||
| 258 | * Initialize the subject instance. |
||
| 259 | * |
||
| 260 | * @param \TechDivision\Import\Services\RegistryProcessorInterface $registryProcessor The registry processor instance |
||
| 261 | * @param \TechDivision\Import\Utils\Generators\GeneratorInterface $coreConfigDataUidGenerator The UID generator for the core config data |
||
| 262 | * @param \Doctrine\Common\Collections\Collection $systemLoggers The array with the system loggers instances |
||
| 263 | * @param \League\Event\EmitterInterface $emitter The event emitter instance |
||
| 264 | */ |
||
| 265 | 82 | public function __construct( |
|
| 276 | |||
| 277 | /** |
||
| 278 | * Return's the event emitter instance. |
||
| 279 | * |
||
| 280 | * @return \League\Event\EmitterInterface The event emitter instance |
||
| 281 | */ |
||
| 282 | 9 | public function getEmitter() |
|
| 286 | |||
| 287 | /** |
||
| 288 | * Set's the name of the file to import |
||
| 289 | * |
||
| 290 | * @param string $filename The filename |
||
| 291 | * |
||
| 292 | * @return void |
||
| 293 | */ |
||
| 294 | 13 | public function setFilename($filename) |
|
| 298 | |||
| 299 | /** |
||
| 300 | * Return's the name of the file to import. |
||
| 301 | * |
||
| 302 | * @return string The filename |
||
| 303 | */ |
||
| 304 | 13 | public function getFilename() |
|
| 308 | |||
| 309 | /** |
||
| 310 | * Set's the actual line number. |
||
| 311 | * |
||
| 312 | * @param integer $lineNumber The line number |
||
| 313 | * |
||
| 314 | * @return void |
||
| 315 | */ |
||
| 316 | 1 | public function setLineNumber($lineNumber) |
|
| 320 | |||
| 321 | /** |
||
| 322 | * Return's the actual line number. |
||
| 323 | * |
||
| 324 | * @return integer The line number |
||
| 325 | */ |
||
| 326 | 11 | public function getLineNumber() |
|
| 330 | |||
| 331 | /** |
||
| 332 | * Return's the default callback mappings. |
||
| 333 | * |
||
| 334 | * @return array The default callback mappings |
||
| 335 | */ |
||
| 336 | 1 | public function getDefaultCallbackMappings() |
|
| 340 | |||
| 341 | /** |
||
| 342 | * Tries to format the passed value to a valid date with format 'Y-m-d H:i:s'. |
||
| 343 | * If the passed value is NOT a valid date, NULL will be returned. |
||
| 344 | * |
||
| 345 | * @param string $value The value to format |
||
| 346 | * |
||
| 347 | * @return string|null The formatted date or NULL if the date is not valid |
||
| 348 | */ |
||
| 349 | public function formatDate($value) |
||
| 353 | |||
| 354 | /** |
||
| 355 | * Extracts the elements of the passed value by exploding them |
||
| 356 | * with the also passed delimiter. |
||
| 357 | * |
||
| 358 | * @param string $value The value to extract |
||
| 359 | * @param string|null $delimiter The delimiter used to extrace the elements |
||
| 360 | * |
||
| 361 | * @return array The exploded values |
||
| 362 | */ |
||
| 363 | public function explode($value, $delimiter = null) |
||
| 367 | |||
| 368 | /** |
||
| 369 | * Queries whether or not debug mode is enabled or not, default is TRUE. |
||
| 370 | * |
||
| 371 | * @return boolean TRUE if debug mode is enabled, else FALSE |
||
| 372 | */ |
||
| 373 | 1 | public function isDebugMode() |
|
| 377 | |||
| 378 | /** |
||
| 379 | * Return's the subject's execution context configuration. |
||
| 380 | * |
||
| 381 | * @return \TechDivision\Import\ExecutionContextInterface The execution context configuration to use |
||
| 382 | */ |
||
| 383 | public function getExecutionContext() |
||
| 387 | |||
| 388 | /** |
||
| 389 | * Set's the subject configuration. |
||
| 390 | * |
||
| 391 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $configuration The subject configuration |
||
| 392 | * |
||
| 393 | * @return void |
||
| 394 | */ |
||
| 395 | 82 | public function setConfiguration(SubjectConfigurationInterface $configuration) |
|
| 399 | |||
| 400 | /** |
||
| 401 | * Return's the subject configuration. |
||
| 402 | * |
||
| 403 | * @return \TechDivision\Import\Configuration\SubjectConfigurationInterface The subject configuration |
||
| 404 | */ |
||
| 405 | 82 | public function getConfiguration() |
|
| 409 | |||
| 410 | /** |
||
| 411 | * Set's the import adapter instance. |
||
| 412 | * |
||
| 413 | * @param \TechDivision\Import\Adapter\ImportAdapterInterface $importAdapter The import adapter instance |
||
| 414 | * |
||
| 415 | * @return void |
||
| 416 | */ |
||
| 417 | 1 | public function setImportAdapter(ImportAdapterInterface $importAdapter) |
|
| 421 | |||
| 422 | /** |
||
| 423 | * Return's the import adapter instance. |
||
| 424 | * |
||
| 425 | * @return \TechDivision\Import\Adapter\ImportAdapterInterface The import adapter instance |
||
| 426 | */ |
||
| 427 | 1 | public function getImportAdapter() |
|
| 431 | |||
| 432 | /** |
||
| 433 | * Return's the RegistryProcessor instance to handle the running threads. |
||
| 434 | * |
||
| 435 | * @return \TechDivision\Import\Services\RegistryProcessorInterface The registry processor instance |
||
| 436 | */ |
||
| 437 | 82 | public function getRegistryProcessor() |
|
| 441 | |||
| 442 | /** |
||
| 443 | * Set's the unique serial for this import process. |
||
| 444 | * |
||
| 445 | * @param string $serial The unique serial |
||
| 446 | * |
||
| 447 | * @return void |
||
| 448 | */ |
||
| 449 | 9 | public function setSerial($serial) |
|
| 453 | |||
| 454 | /** |
||
| 455 | * Return's the unique serial for this import process. |
||
| 456 | * |
||
| 457 | * @return string The unique serial |
||
| 458 | */ |
||
| 459 | 2 | public function getSerial() |
|
| 463 | |||
| 464 | /** |
||
| 465 | * Merge's the passed status into the actual one. |
||
| 466 | * |
||
| 467 | * @param array $status The status to MergeBuilder |
||
| 468 | * |
||
| 469 | * @return void |
||
| 470 | */ |
||
| 471 | 2 | public function mergeStatus(array $status) |
|
| 475 | |||
| 476 | /** |
||
| 477 | * Retur's the actual status. |
||
| 478 | * |
||
| 479 | * @return array The actual status |
||
| 480 | */ |
||
| 481 | 1 | public function getStatus() |
|
| 485 | |||
| 486 | /** |
||
| 487 | * Return's the unique identifier for the actual invocation. |
||
| 488 | * |
||
| 489 | * @return string The unique identifier |
||
| 490 | */ |
||
| 491 | 2 | public function getUniqueId() |
|
| 495 | |||
| 496 | /** |
||
| 497 | * Return's the source date format to use. |
||
| 498 | * |
||
| 499 | * @return string The source date format |
||
| 500 | */ |
||
| 501 | public function getSourceDateFormat() |
||
| 505 | |||
| 506 | /** |
||
| 507 | * Return's the multiple field delimiter character to use, default value is comma (,). |
||
| 508 | * |
||
| 509 | * @return string The multiple field delimiter character |
||
| 510 | */ |
||
| 511 | 1 | public function getMultipleFieldDelimiter() |
|
| 515 | |||
| 516 | /** |
||
| 517 | * Return's the multiple value delimiter character to use, default value is comma (|). |
||
| 518 | * |
||
| 519 | * @return string The multiple value delimiter character |
||
| 520 | */ |
||
| 521 | 1 | public function getMultipleValueDelimiter() |
|
| 525 | |||
| 526 | /** |
||
| 527 | * Intializes the previously loaded global data for exactly one bunch. |
||
| 528 | * |
||
| 529 | * @param string $serial The serial of the actual import |
||
| 530 | * |
||
| 531 | * @return void |
||
| 532 | */ |
||
| 533 | 82 | public function setUp($serial) |
|
| 576 | |||
| 577 | /** |
||
| 578 | * Clean up the global data after importing the variants. |
||
| 579 | * |
||
| 580 | * @param string $serial The serial of the actual import |
||
| 581 | * |
||
| 582 | * @return void |
||
| 583 | */ |
||
| 584 | 1 | public function tearDown($serial) |
|
| 598 | |||
| 599 | /** |
||
| 600 | * Return's the target directory for the artefact export. |
||
| 601 | * |
||
| 602 | * @return string The target directory for the artefact export |
||
| 603 | */ |
||
| 604 | 1 | View Code Duplication | public function getTargetDir() |
| 618 | |||
| 619 | /** |
||
| 620 | * Register the passed observer with the specific type. |
||
| 621 | * |
||
| 622 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer to register |
||
| 623 | * @param string $type The type to register the observer with |
||
| 624 | * |
||
| 625 | * @return void |
||
| 626 | */ |
||
| 627 | 6 | public function registerObserver(ObserverInterface $observer, $type) |
|
| 639 | |||
| 640 | /** |
||
| 641 | * Register the passed callback with the specific type. |
||
| 642 | * |
||
| 643 | * @param \TechDivision\Import\Callbacks\CallbackInterface $callback The subject to register the callbacks for |
||
| 644 | * @param string $type The type to register the callback with |
||
| 645 | * |
||
| 646 | * @return void |
||
| 647 | */ |
||
| 648 | 2 | public function registerCallback(CallbackInterface $callback, $type) |
|
| 660 | |||
| 661 | /** |
||
| 662 | * Return's the array with callbacks for the passed type. |
||
| 663 | * |
||
| 664 | * @param string $type The type of the callbacks to return |
||
| 665 | * |
||
| 666 | * @return array The callbacks |
||
| 667 | */ |
||
| 668 | 1 | public function getCallbacksByType($type) |
|
| 682 | |||
| 683 | /** |
||
| 684 | * Return's the array with the available observers. |
||
| 685 | * |
||
| 686 | * @return array The observers |
||
| 687 | */ |
||
| 688 | 6 | public function getObservers() |
|
| 692 | |||
| 693 | /** |
||
| 694 | * Return's the array with the available callbacks. |
||
| 695 | * |
||
| 696 | * @return array The callbacks |
||
| 697 | */ |
||
| 698 | 1 | public function getCallbacks() |
|
| 702 | |||
| 703 | /** |
||
| 704 | * Return's the callback mappings for this subject. |
||
| 705 | * |
||
| 706 | * @return array The array with the subject's callback mappings |
||
| 707 | */ |
||
| 708 | 2 | public function getCallbackMappings() |
|
| 712 | |||
| 713 | /** |
||
| 714 | * Imports the content of the file with the passed filename. |
||
| 715 | * |
||
| 716 | * |
||
| 717 | * @param string $serial The serial of the actual import |
||
| 718 | * @param string $filename The filename to process |
||
| 719 | * |
||
| 720 | * @return void |
||
| 721 | * @throws \Exception Is thrown, if the import can't be processed |
||
| 722 | */ |
||
| 723 | 2 | public function import($serial, $filename) |
|
| 824 | |||
| 825 | /** |
||
| 826 | * Imports the passed row into the database. If the import failed, the exception |
||
| 827 | * will be catched and logged, but the import process will be continued. |
||
| 828 | * |
||
| 829 | * @param array $row The row with the data to be imported |
||
| 830 | * |
||
| 831 | * @return void |
||
| 832 | */ |
||
| 833 | 7 | public function importRow(array $row) |
|
| 916 | |||
| 917 | /** |
||
| 918 | * Queries whether or not that the subject needs an OK file to be processed. |
||
| 919 | * |
||
| 920 | * @return boolean TRUE if the subject needs an OK file, else FALSE |
||
| 921 | */ |
||
| 922 | 1 | public function isOkFileNeeded() |
|
| 926 | |||
| 927 | /** |
||
| 928 | * Return's the default store. |
||
| 929 | * |
||
| 930 | * @return array The default store |
||
| 931 | */ |
||
| 932 | public function getDefaultStore() |
||
| 936 | |||
| 937 | /** |
||
| 938 | * Return's the default store view code. |
||
| 939 | * |
||
| 940 | * @return array The default store view code |
||
| 941 | */ |
||
| 942 | 4 | public function getDefaultStoreViewCode() |
|
| 946 | |||
| 947 | /** |
||
| 948 | * Set's the store view code the create the product/attributes for. |
||
| 949 | * |
||
| 950 | * @param string $storeViewCode The store view code |
||
| 951 | * |
||
| 952 | * @return void |
||
| 953 | */ |
||
| 954 | 3 | public function setStoreViewCode($storeViewCode) |
|
| 958 | |||
| 959 | /** |
||
| 960 | * Return's the store view code the create the product/attributes for. |
||
| 961 | * |
||
| 962 | * @param string|null $default The default value to return, if the store view code has not been set |
||
| 963 | * |
||
| 964 | * @return string The store view code |
||
| 965 | */ |
||
| 966 | 6 | public function getStoreViewCode($default = null) |
|
| 983 | |||
| 984 | /** |
||
| 985 | * Prepare's the store view code in the subject. If the store_view_code row doesn't contain |
||
| 986 | * any value, the default code of the default store view will be set. |
||
| 987 | * |
||
| 988 | * @return void |
||
| 989 | */ |
||
| 990 | 1 | public function prepareStoreViewCode() |
|
| 1001 | |||
| 1002 | /** |
||
| 1003 | * Return's the store ID of the store with the passed store view code |
||
| 1004 | * |
||
| 1005 | * @param string $storeViewCode The store view code to return the store ID for |
||
| 1006 | * |
||
| 1007 | * @return integer The ID of the store with the passed ID |
||
| 1008 | * @throws \Exception Is thrown, if the store with the actual code is not available |
||
| 1009 | */ |
||
| 1010 | 2 | public function getStoreId($storeViewCode) |
|
| 1028 | |||
| 1029 | /** |
||
| 1030 | * Return's the store ID of the actual row, or of the default store |
||
| 1031 | * if no store view code is set in the CSV file. |
||
| 1032 | * |
||
| 1033 | * @param string|null $default The default store view code to use, if no store view code is set in the CSV file |
||
| 1034 | * |
||
| 1035 | * @return integer The ID of the actual store |
||
| 1036 | * @throws \Exception Is thrown, if the store with the actual code is not available |
||
| 1037 | */ |
||
| 1038 | 1 | public function getRowStoreId($default = null) |
|
| 1049 | |||
| 1050 | /** |
||
| 1051 | * Return's the root category for the actual view store. |
||
| 1052 | * |
||
| 1053 | * @return array The store's root category |
||
| 1054 | * @throws \Exception Is thrown if the root category for the passed store code is NOT available |
||
| 1055 | */ |
||
| 1056 | 2 | public function getRootCategory() |
|
| 1070 | |||
| 1071 | /** |
||
| 1072 | * Return's the Magento configuration value. |
||
| 1073 | * |
||
| 1074 | * @param string $path The Magento path of the requested configuration value |
||
| 1075 | * @param mixed $default The default value that has to be returned, if the requested configuration value is not set |
||
| 1076 | * @param string $scope The scope the configuration value has been set |
||
| 1077 | * @param integer $scopeId The scope ID the configuration value has been set |
||
| 1078 | * |
||
| 1079 | * @return mixed The configuration value |
||
| 1080 | * @throws \Exception Is thrown, if nor a value can be found or a default value has been passed |
||
| 1081 | */ |
||
| 1082 | 5 | public function getCoreConfigData($path, $default = null, $scope = ScopeKeys::SCOPE_DEFAULT, $scopeId = 0) |
|
| 1158 | |||
| 1159 | /** |
||
| 1160 | * Resolve the original column name for the passed one. |
||
| 1161 | * |
||
| 1162 | * @param string $columnName The column name that has to be resolved |
||
| 1163 | * |
||
| 1164 | * @return string|null The original column name |
||
| 1165 | */ |
||
| 1166 | 1 | public function resolveOriginalColumnName($columnName) |
|
| 1188 | |||
| 1189 | /** |
||
| 1190 | * Return's the original data if available, or an empty array. |
||
| 1191 | * |
||
| 1192 | * @return array The original data |
||
| 1193 | */ |
||
| 1194 | 1 | public function getOriginalData() |
|
| 1209 | |||
| 1210 | /** |
||
| 1211 | * Query's whether or not the actual column contains original data like |
||
| 1212 | * filename, line number and column names. |
||
| 1213 | * |
||
| 1214 | * @return boolean TRUE if the actual column contains origin data, else FALSE |
||
| 1215 | */ |
||
| 1216 | 1 | public function hasOriginalData() |
|
| 1220 | |||
| 1221 | /** |
||
| 1222 | * Wraps the passed exeception into a new one by trying to resolve the original filname, |
||
| 1223 | * line number and column names and use it for a detailed exception message. |
||
| 1224 | * |
||
| 1225 | * @param array $columnNames The column names that should be resolved and wrapped |
||
| 1226 | * @param \Exception $parent The exception we want to wrap |
||
| 1227 | * @param string $className The class name of the exception type we want to wrap the parent one |
||
| 1228 | * |
||
| 1229 | * @return \Exception the wrapped exception |
||
| 1230 | */ |
||
| 1231 | public function wrapException( |
||
| 1275 | |||
| 1276 | /** |
||
| 1277 | * Strip's the exception suffix containing filename and line number from the |
||
| 1278 | * passed message. |
||
| 1279 | * |
||
| 1280 | * @param string $message The message to strip the exception suffix from |
||
| 1281 | * |
||
| 1282 | * @return mixed The message without the exception suffix |
||
| 1283 | */ |
||
| 1284 | public function stripExceptionSuffix($message) |
||
| 1288 | |||
| 1289 | /** |
||
| 1290 | * Append's the exception suffix containing filename and line number to the |
||
| 1291 | * passed message. If no message has been passed, only the suffix will be |
||
| 1292 | * returned |
||
| 1293 | * |
||
| 1294 | * @param string|null $message The message to append the exception suffix to |
||
| 1295 | * @param string|null $filename The filename used to create the suffix |
||
| 1296 | * @param string|null $lineNumber The line number used to create the suffx |
||
| 1297 | * |
||
| 1298 | * @return string The message with the appended exception suffix |
||
| 1299 | */ |
||
| 1300 | 8 | public function appendExceptionSuffix($message = null, $filename = null, $lineNumber = null) |
|
| 1321 | |||
| 1322 | /** |
||
| 1323 | * Raises the value for the counter with the passed key by one. |
||
| 1324 | * |
||
| 1325 | * @param mixed $counterName The name of the counter to raise |
||
| 1326 | * |
||
| 1327 | * @return integer The counter's new value |
||
| 1328 | */ |
||
| 1329 | 1 | public function raiseCounter($counterName) |
|
| 1338 | |||
| 1339 | /** |
||
| 1340 | * Merge the passed array into the status of the actual import. |
||
| 1341 | * |
||
| 1342 | * @param array $status The status information to be merged |
||
| 1343 | * |
||
| 1344 | * @return void |
||
| 1345 | */ |
||
| 1346 | 1 | public function mergeAttributesRecursive(array $status) |
|
| 1355 | |||
| 1356 | /** |
||
| 1357 | * Return's the entity type code to be used. |
||
| 1358 | * |
||
| 1359 | * @return string The entity type code to be used |
||
| 1360 | */ |
||
| 1361 | public function getEntityTypeCode() |
||
| 1375 | } |
||
| 1376 |
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..