Code Duplication    Length = 18-23 lines in 2 locations

src/Observers/BundleOptionObserver.php 1 location

@@ 73-95 (lines=23) @@
70
     *
71
     * @return array The processed row
72
     */
73
    protected function process()
74
    {
75
76
        // prepare the store view code
77
        $this->prepareStoreViewCode($this->getRow());
78
79
        // return immediately if we're have no store view code set
80
        if (StoreViewCodes::ADMIN !== $this->getStoreViewCode(StoreViewCodes::ADMIN)) {
81
            return;
82
        }
83
84
        // query whether or not the option has already been created
85
        if (!$this->exists($name = $this->getValue(ColumnKeys::BUNDLE_VALUE_NAME))) {
86
            // load the bundle option
87
            $bundleOption = $this->initializeBundleOption($this->prepareAttributes());
88
89
            // persist the product bundle option
90
            $optionId = $this->persistProductBundleOption($bundleOption);
91
92
            // store the name => option ID mapping
93
            $this->addNameOptionIdMapping($name, $optionId);
94
        }
95
    }
96
97
    /**
98
     * Prepare the attributes of the entity that has to be persisted.

src/Observers/BundleSelectionObserver.php 1 location

@@ 73-90 (lines=18) @@
70
     *
71
     * @return array The processed row
72
     */
73
    protected function process()
74
    {
75
76
        // prepare the store view code
77
        $this->prepareStoreViewCode($this->getRow());
78
79
        // return immediately if we're have no store view code set
80
        if (StoreViewCodes::ADMIN !== $this->getStoreViewCode(StoreViewCodes::ADMIN)) {
81
            return;
82
        }
83
84
        // prepare, initialize and persist the product bundle selection data
85
        $productBundleSelection = $this->initializeBundleSelection($this->prepareAttributes());
86
        $selectionId = $this->persistProductBundleSelection($productBundleSelection);
87
88
        // add the mapping for the child SKU => selection ID
89
        $this->addChildSkuSelectionIdMapping($this->getValue(ColumnKeys::BUNDLE_VALUE_SKU), $selectionId);
90
    }
91
92
    /**
93
     * Prepare the attributes of the entity that has to be persisted.