Skip to content

Commit 7dbdfd5

Browse files
committed
Fix CodeStyle problems
1 parent f06e4d7 commit 7dbdfd5

File tree

1 file changed

+42
-19
lines changed

1 file changed

+42
-19
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/LinkProcessor.php

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,34 @@ class LinkProcessor
2525
private $linkNameToId;
2626

2727
/**
28-
* @var LinkFactory
28+
* @var LinkFactory
2929
*/
3030
private $linkFactory;
3131

3232
/**
33-
* @var Helper
33+
* @var Helper
3434
*/
3535
private $resourceHelper;
3636

3737
/**
38-
* @var SkuProcessor
38+
* @var SkuProcessor
3939
*/
4040
private $skuProcessor;
4141

4242
/**
43-
* @var LoggerInterface
43+
* @var LoggerInterface
4444
*/
4545
private $logger;
4646

47+
/**
48+
* LinkProcessor constructor.
49+
*
50+
* @param LinkFactory $linkFactory
51+
* @param Helper $resourceHelper
52+
* @param SkuProcessor $skuProcessor
53+
* @param LoggerInterface $logger
54+
* @param array $linkNameToId
55+
*/
4756
public function __construct(
4857
LinkFactory $linkFactory,
4958
Helper $resourceHelper,
@@ -64,17 +73,17 @@ public function __construct(
6473
*
6574
* Must be called after ALL products saving done.
6675
*
76+
* @param Product $importEntity
77+
* @param Data $dataSourceModel
78+
* @param string $linkField
6779
* @return $this
6880
* @throws LocalizedException
6981
*/
7082
public function saveLinks(
7183
Product $importEntity,
7284
Data $dataSourceModel,
7385
string $linkField
74-
) {
75-
/**
76-
* @var Link $resource
77-
*/
86+
): void {
7887
$resource = $this->linkFactory->create();
7988
$mainTable = $resource->getMainTable();
8089
$positionAttrId = [];
@@ -94,21 +103,27 @@ public function saveLinks(
94103
while ($bunch = $dataSourceModel->getNextBunch()) {
95104
$this->processLinkBunches($importEntity, $linkField, $bunch, $resource, $nextLinkId, $positionAttrId);
96105
}
97-
98-
return $this;
99106
}
100107

101-
public function addNameToIds($nameToIds)
108+
/**
109+
* Add link types (exists for backwards compatibility)
110+
*
111+
* @deprecated Use DI to inject to the constructor
112+
* @param array $nameToIds
113+
*/
114+
public function addNameToIds(array $nameToIds): void
102115
{
103116
$this->linkNameToId = array_merge($nameToIds, $this->linkNameToId);
104117
}
105118

106119
/**
107120
* Processes link bunches
108121
*
122+
* @param Product $importEntity
123+
* @param string $linkField
109124
* @param array $bunch
110-
* @param Link $resource
111-
* @param int $nextLinkId
125+
* @param Link $resource
126+
* @param int $nextLinkId
112127
* @param array $positionAttrId
113128
*
114129
* @return void
@@ -194,10 +209,11 @@ function ($linkedSku) use ($sku, $importEntity) {
194209
/**
195210
* Check if product exists for specified SKU
196211
*
197-
* @param string $sku
212+
* @param Product $importEntity
213+
* @param string $sku
198214
* @return bool
199215
*/
200-
private function isSkuExist(Product $importEntity, $sku)
216+
private function isSkuExist(Product $importEntity, string $sku): bool
201217
{
202218
$sku = strtolower($sku);
203219
return isset($importEntity->getOldSku()[$sku]);
@@ -206,8 +222,9 @@ private function isSkuExist(Product $importEntity, $sku)
206222
/**
207223
* Fetches Product Links
208224
*
225+
* @param Product $importEntity
209226
* @param Link $resource
210-
* @param int $productId
227+
* @param int $productId
211228
*
212229
* @return array
213230
*/
@@ -248,15 +265,21 @@ private function getProductLinkedId(string $linkedSku): ?int
248265
/**
249266
* Saves information about product links
250267
*
251-
* @param Link $resource
268+
* @param Product $importEntity
269+
* @param Link $resource
252270
* @param array $productIds
253271
* @param array $linkRows
254272
* @param array $positionRows
255273
*
256274
* @throws LocalizedException
257275
*/
258-
private function saveLinksData(Product $importEntity, Link $resource, array $productIds, array $linkRows, array $positionRows)
259-
{
276+
private function saveLinksData(
277+
Product $importEntity,
278+
Link $resource,
279+
array $productIds,
280+
array $linkRows,
281+
array $positionRows
282+
) {
260283
$mainTable = $resource->getMainTable();
261284
if (Import::BEHAVIOR_APPEND != $importEntity->getBehavior() && $productIds) {
262285
$importEntity->getConnection()->delete(

0 commit comments

Comments
 (0)