Code Duplication    Length = 18-23 lines in 2 locations

src/Observers/BundleOptionObserver.php 1 location

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

src/Observers/BundleSelectionObserver.php 1 location

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