Code Duplication    Length = 22-24 lines in 2 locations

src/Observers/BundleOptionObserver.php 1 location

@@ 74-97 (lines=24) @@
71
     *
72
     * @return array The prepared attributes
73
     */
74
    protected function prepareAttributes()
75
    {
76
77
        // reset the position counter for the bundle selection
78
        $this->resetPositionCounter();
79
80
        // load and map the parent option ID
81
        $parentId = $this->mapSku($this->getValue(ColumnKeys::BUNDLE_PARENT_SKU));
82
83
        // extract the parent/child ID as well as type and position
84
        $required = $this->getValue(ColumnKeys::BUNDLE_VALUE_REQUIRED);
85
        $type = $this->getValue(ColumnKeys::BUNDLE_VALUE_TYPE);
86
        $position = 1;
87
88
        // return the prepared product
89
        return $this->initializeEntity(
90
            array(
91
                MemberNames::PARENT_ID => $parentId,
92
                MemberNames::REQUIRED  => $required,
93
                MemberNames::POSITION  => $position,
94
                MemberNames::TYPE      => $type
95
            )
96
        );
97
    }
98
99
    /**
100
     * Initialize the bundle option with the passed attributes and returns an instance.

src/Observers/BundleOptionValueObserver.php 1 location

@@ 84-105 (lines=22) @@
81
     *
82
     * @return array The prepared attributes
83
     */
84
    protected function prepareAttributes()
85
    {
86
87
        // load the product bundle option name
88
        $name = $this->getValue(ColumnKeys::BUNDLE_VALUE_NAME);
89
90
        // load the actual option ID
91
        $optionId = $this->getLastOptionId();
92
93
        // load the store/website ID
94
        $store = $this->getStoreByStoreCode($this->getStoreViewCode(StoreViewCodes::ADMIN));
95
        $storeId = $store[MemberNames::STORE_ID];
96
97
        // return the prepared product
98
        return $this->initializeEntity(
99
            array(
100
                MemberNames::OPTION_ID => $optionId,
101
                MemberNames::STORE_ID  => $storeId,
102
                MemberNames::TITLE     => $name
103
            )
104
        );
105
    }
106
107
    /**
108
     * Initialize the bundle option value with the passed attributes and returns an instance.