Code Duplication    Length = 18-23 lines in 2 locations

src/Observers/BundleOptionObserver.php 1 location

@@ 45-67 (lines=23) @@
42
     *
43
     * @return array The processed row
44
     */
45
    protected function process()
46
    {
47
48
        // prepare the store view code
49
        $this->prepareStoreViewCode($this->getRow());
50
51
        // return immediately if we're have no store view code set
52
        if (StoreViewCodes::ADMIN !== $this->getStoreViewCode(StoreViewCodes::ADMIN)) {
53
            return;
54
        }
55
56
        // query whether or not the option has already been created
57
        if (!$this->exists($name = $this->getValue(ColumnKeys::BUNDLE_VALUE_NAME))) {
58
            // load the bundle option
59
            $bundleOption = $this->initializeBundleOption($this->prepareAttributes());
60
61
            // persist the product bundle option
62
            $optionId = $this->persistProductBundleOption($bundleOption);
63
64
            // store the name => option ID mapping
65
            $this->addNameOptionIdMapping($name, $optionId);
66
        }
67
    }
68
69
    /**
70
     * Prepare the attributes of the entity that has to be persisted.

src/Observers/BundleSelectionObserver.php 1 location

@@ 45-62 (lines=18) @@
42
     *
43
     * @return array The processed row
44
     */
45
    protected function process()
46
    {
47
48
        // prepare the store view code
49
        $this->prepareStoreViewCode($this->getRow());
50
51
        // return immediately if we're have no store view code set
52
        if (StoreViewCodes::ADMIN !== $this->getStoreViewCode(StoreViewCodes::ADMIN)) {
53
            return;
54
        }
55
56
        // prepare, initialize and persist the product bundle selection data
57
        $productBundleSelection = $this->initializeBundleSelection($this->prepareAttributes());
58
        $selectionId = $this->persistProductBundleSelection($productBundleSelection);
59
60
        // add the mapping for the child SKU => selection ID
61
        $this->addChildSkuSelectionIdMapping($this->getValue(ColumnKeys::BUNDLE_VALUE_SKU), $selectionId);
62
    }
63
64
    /**
65
     * Prepare the attributes of the entity that has to be persisted.