Code Duplication    Length = 22-24 lines in 2 locations

src/Observers/BundleOptionObserver.php 1 location

@@ 95-118 (lines=24) @@
92
     *
93
     * @return array The prepared attributes
94
     */
95
    protected function prepareAttributes()
96
    {
97
98
        // reset the position counter for the bundle selection
99
        $this->resetPositionCounter();
100
101
        // load and map the parent option ID
102
        $parentId = $this->mapSku($this->getValue(ColumnKeys::BUNDLE_PARENT_SKU));
103
104
        // extract the parent/child ID as well as type and position
105
        $required = $this->getValue(ColumnKeys::BUNDLE_VALUE_REQUIRED);
106
        $type = $this->getValue(ColumnKeys::BUNDLE_VALUE_TYPE);
107
        $position = 1;
108
109
        // return the prepared product
110
        return $this->initializeEntity(
111
            array(
112
                MemberNames::PARENT_ID => $parentId,
113
                MemberNames::REQUIRED  => $required,
114
                MemberNames::POSITION  => $position,
115
                MemberNames::TYPE      => $type
116
            )
117
        );
118
    }
119
120
    /**
121
     * Initialize the bundle option with the passed attributes and returns an instance.

src/Observers/BundleOptionValueObserver.php 1 location

@@ 105-126 (lines=22) @@
102
     *
103
     * @return array The prepared attributes
104
     */
105
    protected function prepareAttributes()
106
    {
107
108
        // load the product bundle option name
109
        $name = $this->getValue(ColumnKeys::BUNDLE_VALUE_NAME);
110
111
        // load the actual option ID
112
        $optionId = $this->getLastOptionId();
113
114
        // load the store/website ID
115
        $store = $this->getStoreByStoreCode($this->getStoreViewCode(StoreViewCodes::ADMIN));
116
        $storeId = $store[MemberNames::STORE_ID];
117
118
        // return the prepared product
119
        return $this->initializeEntity(
120
            array(
121
                MemberNames::OPTION_ID => $optionId,
122
                MemberNames::STORE_ID  => $storeId,
123
                MemberNames::TITLE     => $name
124
            )
125
        );
126
    }
127
128
    /**
129
     * Initialize the bundle option value with the passed attributes and returns an instance.