Code Duplication    Length = 16-16 lines in 2 locations

Subscribers/ProductStreams.php 1 location

@@ 227-242 (lines=16) @@
224
            if ($productStreamService->allowToRemove($assignments, $streamId, $item['articleId'])) {
225
                $this->sdk->recordDelete($item['sourceId']);
226
                $removedRecords[] = $item['sourceId'];
227
            } else {
228
                //updates items with the new streams
229
                $streamCollection = $assignments->getStreamsByArticleId($item['articleId']);
230
                if (!$this->helper->isMainVariant($item['sourceId']) || !$streamCollection) {
231
                    continue;
232
                }
233
234
                //removes current stream from the collection
235
                unset($streamCollection[$streamId]);
236
237
                $this->sdk->recordStreamAssignment(
238
                    $item['sourceId'],
239
                    $streamCollection,
240
                    $item['groupId']
241
                );
242
            }
243
        }
244
245
        $this->connectExport->updateConnectItemsStatus($removedRecords, Attribute::STATUS_DELETE);

Controllers/Backend/Connect.php 1 location

@@ 1624-1639 (lines=16) @@
1621
                    if ($productStreamService->allowToRemove($assignments, $streamId, $item['articleId'])) {
1622
                        $this->getSDK()->recordDelete($item['sourceId']);
1623
                        $removedRecords[] = $item['sourceId'];
1624
                    } else {
1625
                        //updates items with the new streams
1626
                        $streamCollection = $assignments->getStreamsByArticleId($item['articleId']);
1627
                        if (!$this->getHelper()->isMainVariant($item['sourceId']) || !$streamCollection) {
1628
                            continue;
1629
                        }
1630
1631
                        //removes current stream from the collection
1632
                        unset($streamCollection[$streamId]);
1633
1634
                        $this->getSDK()->recordStreamAssignment(
1635
                            $item['sourceId'],
1636
                            $streamCollection,
1637
                            $item['groupId']
1638
                        );
1639
                    }
1640
                }
1641
1642
                $connectExport->updateConnectItemsStatus($removedRecords, Attribute::STATUS_DELETE);