techdivision /
import-converter-ee
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * TechDivision\Import\Converter\Ee\Subjects\ConverterSubject |
||
| 5 | * |
||
| 6 | * NOTICE OF LICENSE |
||
| 7 | * |
||
| 8 | * This source file is subject to the Open Software License (OSL 3.0) |
||
| 9 | * that is available through the world-wide-web at this URL: |
||
| 10 | * http://opensource.org/licenses/osl-3.0.php |
||
| 11 | * |
||
| 12 | * PHP version 5 |
||
| 13 | * |
||
| 14 | * @author Tim Wagner <[email protected]> |
||
| 15 | * @copyright 2018 TechDivision GmbH <[email protected]> |
||
| 16 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
||
| 17 | * @link https://github.com/techdivision/import-converter-ee |
||
| 18 | * @link http://www.techdivision.com |
||
| 19 | */ |
||
| 20 | |||
| 21 | namespace TechDivision\Import\Converter\Ee\Subjects; |
||
| 22 | |||
| 23 | use TechDivision\Import\Converter\Subjects\ConverterSubject; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Converter subject implementation. |
||
| 27 | * |
||
| 28 | * @author Tim Wagner <[email protected]> |
||
| 29 | * @copyright 2018 TechDivision GmbH <[email protected]> |
||
| 30 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
||
| 31 | * @link https://github.com/techdivision/import-converter-ee |
||
| 32 | * @link http://www.techdivision.com |
||
| 33 | */ |
||
| 34 | class EeConverterSubject extends ConverterSubject |
||
| 35 | { |
||
| 36 | |||
| 37 | /** |
||
| 38 | * The row ID of the product that has been created recently. |
||
| 39 | * |
||
| 40 | * @var integer |
||
| 41 | */ |
||
| 42 | protected $lastRowId; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * The mapping for the SKUs to the created row IDs. |
||
| 46 | * |
||
| 47 | * @var array |
||
| 48 | */ |
||
| 49 | protected $skuRowIdMapping = array(); |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Set's the row ID of the product that has been created recently. |
||
| 53 | * |
||
| 54 | * @param string $lastRowId The row ID |
||
| 55 | * |
||
| 56 | * @return void |
||
| 57 | */ |
||
| 58 | public function setLastRowId($lastRowId) |
||
| 59 | { |
||
| 60 | $this->lastRowId = $lastRowId; |
||
|
0 ignored issues
–
show
|
|||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Return's the row ID of the product that has been created recently. |
||
| 65 | * |
||
| 66 | * @return string The row Id |
||
| 67 | */ |
||
| 68 | public function getLastRowId() |
||
| 69 | { |
||
| 70 | return $this->lastRowId; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Add the passed SKU => row ID mapping. |
||
| 75 | * |
||
| 76 | * @param string $sku The SKU |
||
| 77 | * |
||
| 78 | * @return void |
||
| 79 | */ |
||
| 80 | public function addSkuRowIdMapping($sku) |
||
| 81 | { |
||
| 82 | $this->skuRowIdMapping[$sku] = $this->getLastRowId(); |
||
| 83 | } |
||
| 84 | } |
||
| 85 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.