Code Duplication    Length = 14-17 lines in 2 locations

src/Observers/ClearAttributeObserver.php 1 location

@@ 61-77 (lines=17) @@
58
     *
59
     * @return array The processed row
60
     */
61
    protected function process()
62
    {
63
64
        // query whether or not, we've found a new EAV attribute code => means we've found a new attribute
65
        if ($this->hasBeenProcessed($attributeCode = $this->getValue(ColumnKeys::ATTRIBUTE_CODE))) {
66
            return;
67
        }
68
69
        // try to load the EAV attribute with the code found in the CSV file
70
        $attribute = $this->loadAttributeByEntityTypeIdAndAttributeCode($this->getEntityTypeId(), $attributeCode);
71
72
        // delete the EAV attribute with the code found in the CSV file
73
        $this->deleteAttribute(array(MemberNames::ATTRIBUTE_ID => $attribute[MemberNames::ATTRIBUTE_ID]));
74
75
        // temporary persist the ID of the deleted attribute
76
        $this->setLastAttributeId($attribute[MemberNames::ATTRIBUTE_ID]);
77
    }
78
79
    /**
80
     * Return's the attribute bunch processor instance.

src/Observers/AttributeOptionObserver.php 1 location

@@ 157-170 (lines=14) @@
154
     *
155
     * @return array The prepared attributes
156
     */
157
    protected function prepareAttributes()
158
    {
159
160
        // load the attribute ID
161
        $attribute = $this->loadAttributeByEntityTypeIdAndAttributeCode($this->getEntityTypeId(), $this->getValue(ColumnKeys::ATTRIBUTE_CODE));
162
        $attributeId = $attribute[MemberNames::ATTRIBUTE_ID];
163
164
        // return the prepared attribute option
165
        return $this->initializeEntity(
166
            $this->loadRawEntity(
167
                array(MemberNames::ATTRIBUTE_ID => $attributeId)
168
            )
169
        );
170
    }
171
172
    /**
173
     * Load's and return's a raw customer entity without primary key but the mandatory members only and nulled values.