Code Duplication    Length = 25-26 lines in 2 locations

src/Repositories/EavAttributeOptionValueRepository.php 2 locations

@@ 103-127 (lines=25) @@
100
     *
101
     * @return array The EAV attribute option value
102
     */
103
    public function findOneByOptionIdAndStoreId($optionId, $storeId)
104
    {
105
106
        // the parameters of the EAV attribute option to load
107
        $params = array(
108
            MemberNames::OPTION_ID => $optionId,
109
            MemberNames::STORE_ID  => $storeId,
110
        );
111
112
        // load the utility class name
113
        $utilityClassName = $this->getUtilityClassName();
114
115
        // prepare the cache key
116
        $cacheKey = $this->cacheKey($utilityClassName::EAV_ATTRIBUTE_OPTION_VALUE_BY_OPTION_ID_AND_STORE_ID, $params);
117
118
        // query whether or not the result has been cached
119
        if ($this->notCached($cacheKey)) {
120
            // load and return the EAV attribute option value with the passed parameters
121
            $this->eavAttributeOptionValueByOptionIdAndStoreIdStmt->execute($params);
122
            $this->toCache($cacheKey, $this->eavAttributeOptionValueByOptionIdAndStoreIdStmt->fetch(\PDO::FETCH_ASSOC));
123
        }
124
125
        // return the value from the cache
126
        return $this->fromCache($cacheKey);
127
    }
128
129
    /**
130
     * Load's and return's the EAV attribute option value with the passed code, store ID and value.
@@ 138-163 (lines=26) @@
135
     *
136
     * @return array The EAV attribute option value
137
     */
138
    public function findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value)
139
    {
140
141
        // the parameters of the EAV attribute option to load
142
        $params = array(
143
            MemberNames::ATTRIBUTE_CODE => $attributeCode,
144
            MemberNames::STORE_ID       => $storeId,
145
            MemberNames::VALUE          => $value
146
        );
147
148
        // load the utility class name
149
        $utilityClassName = $this->getUtilityClassName();
150
151
        // prepare the cache key
152
        $cacheKey = $this->cacheKey($utilityClassName::EAV_ATTRIBUTE_OPTION_VALUE_BY_ATTRIBUTE_CODE_AND_STORE_ID_AND_VALUE, $params);
153
154
        // query whether or not the result has been cached
155
        if ($this->notCached($cacheKey)) {
156
            // load and return the EAV attribute option value with the passed parameters
157
            $this->eavAttributeOptionValueByAttributeCodeAndStoreIdAndValueStmt->execute($params);
158
            $this->toCache($cacheKey, $this->eavAttributeOptionValueByAttributeCodeAndStoreIdAndValueStmt->fetch(\PDO::FETCH_ASSOC));
159
        }
160
161
        // return the value from the cache
162
        return $this->fromCache($cacheKey);
163
    }
164
}
165