Code Duplication    Length = 15-17 lines in 2 locations

Normalizer/AttributeNormalizer.php 1 location

@@ 37-51 (lines=15) @@
34
    public function normalize($attribute, $format = null, array $context = [])
35
    {
36
        $type = $attribute->getAttributeType();
37
        if ($normalizer = $this->normalizerGuesser->guessNormalizer(
38
          $type,
39
          'attribute'
40
        )
41
        ) {
42
            $normalizedAttribute = $normalizer->normalize(
43
              $attribute,
44
              null,
45
              $context
46
            );
47
        } else {
48
            throw new NormalizeException(
49
              'Type field not supported: "'.$type.'".'
50
            );
51
        }
52
53
        return $normalizedAttribute;
54
    }

Normalizer/ProductNormalizer.php 1 location

@@ 266-282 (lines=17) @@
263
              'configuration' => $configuration,
264
            ];
265
266
            if ($normalizer = $this->normalizerGuesser->guessNormalizer(
267
              $type,
268
              'product_value'
269
            )
270
            ) {
271
                $normalizer->normalize(
272
                  $drupalProduct,
273
                  $value,
274
                  $field,
275
                  $context
276
                );
277
            } else {
278
                throw new NormalizeException(
279
                  'Type field not supported: "'.$type.'".',
280
                  'Normalizing error'
281
                );
282
            }
283
        }
284
    }
285