Code Duplication    Length = 20-21 lines in 2 locations

src/Serializers/AdditionalAttributeCsvSerializer.php 2 locations

@@ 203-222 (lines=20) @@
200
     *
201
     * @return string The packed value
202
     */
203
    protected function pack($attributeCode, $value)
204
    {
205
206
        // load the attibute with the passed code
207
        $attribute = $this->loadAttributeByAttributeCode($attributeCode);
208
209
        // pack the value according to the attribute's frontend input type
210
        switch ($attribute[MemberNames::FRONTEND_INPUT]) {
211
            case FrontendInputTypes::MULTISELECT:
212
                return implode($this->getMultipleValueDelimiter(), $value);
213
                break;
214
215
            case FrontendInputTypes::BOOLEAN:
216
                return $value === true ? 'true' : 'false';
217
                break;
218
219
            default:
220
                return $value;
221
        }
222
    }
223
224
    /**
225
     * Unpacks the passed value according to the frontend input type of the attribute with the passed code.
@@ 232-252 (lines=21) @@
229
     *
230
     * @return mixed The unpacked value
231
     */
232
    protected function unpack($attributeCode, $value)
233
    {
234
235
        // load the attibute with the passed code
236
        $attribute = $this->loadAttributeByAttributeCode($attributeCode);
237
238
        // unpack the value according to the attribute's frontend input type
239
        switch ($attribute[MemberNames::FRONTEND_INPUT]) {
240
            case FrontendInputTypes::MULTISELECT:
241
                return explode($this->getMultipleValueDelimiter(), $value);
242
                break;
243
244
            case FrontendInputTypes::BOOLEAN:
245
                return filter_var($value, FILTER_VALIDATE_BOOLEAN);
246
                break;
247
248
            default:
249
                return $value;
250
        }
251
    }
252
253
    /**
254
     * Passes the configuration and initializes the serializer.
255
     *