Code Duplication    Length = 18-21 lines in 2 locations

src/Repositories/EavAttributeRepository.php 2 locations

@@ 83-103 (lines=21) @@
80
     *
81
     * @return array The array with all available EAV attributes
82
     */
83
    public function findAllByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName)
84
    {
85
86
        // initialize the params
87
        $params = array(
88
            MemberNames::ENTITY_TYPE_ID     => $entityTypeId,
89
            MemberNames::ATTRIBUTE_SET_NAME => $attributeSetName
90
        );
91
92
        // initialize the array for the EAV attributes
93
        $eavAttributes = array();
94
95
        // execute the prepared statement and return the array with the EAV attributes
96
        $this->eavAttributesByEntityTypeIdAndAttributeSetNameStmt->execute($params);
97
        foreach ($this->eavAttributesByEntityTypeIdAndAttributeSetNameStmt->fetchAll(\PDO::FETCH_ASSOC) as $eavAttribute) {
98
            $eavAttributes[$eavAttribute[MemberNames::ATTRIBUTE_CODE]] = $eavAttribute;
99
        }
100
101
        // return the array with the EAV attributes
102
        return $eavAttributes;
103
    }
104
105
    /**
106
     * Return's an array with the available EAV attributes for the passed option value and store ID.
@@ 134-151 (lines=18) @@
131
     *
132
     * @return array The array with the EAV attributes matching the passed flag
133
     */
134
    public function findAllByIsUserDefined($isUserDefined = 1)
135
    {
136
137
        // initialize the array for the EAV attributes
138
        $eavAttributes = array();
139
140
        // initialize the params
141
        $params = array(MemberNames::ID_USER_DEFINED => $isUserDefined);
142
143
        // execute the prepared statement and return the array with the EAV attributes
144
        $this->eavAttributesByUserDefinedStmt->execute($params);
145
        foreach ($this->eavAttributesByUserDefinedStmt->fetchAll(\PDO::FETCH_ASSOC) as $eavAttribute) {
146
            $eavAttributes[$eavAttribute[MemberNames::ATTRIBUTE_CODE]] = $eavAttribute;
147
        }
148
149
        // return the array with the EAV attributes
150
        return $eavAttributes;
151
    }
152
153
    /**
154
     * Return's the first EAV attribute for the passed option value and store ID.