Code Duplication    Length = 5-5 lines in 2 locations

src/JsonApi/Serializer/ItemNormalizer.php 1 location

@@ 159-163 (lines=5) @@
156
    protected function denormalizeRelation(string $attributeName, PropertyMetadata $propertyMetadata, string $className, $value, string $format = null, array $context)
157
    {
158
        // Give a chance to other normalizers (e.g.: DateTimeNormalizer)
159
        if (!$this->resourceClassResolver->isResourceClass($className)) {
160
            $context['resource_class'] = $className;
161
162
            return $this->serializer->denormalize($value, $className, $format, $context);
163
        }
164
165
        if (!is_array($value) || !isset($value['id'], $value['type'])) {
166
            throw new InvalidArgumentException('Only resource linkage supported currently, see: http://jsonapi.org/format/#document-resource-object-linkage.');

src/Serializer/AbstractItemNormalizer.php 1 location

@@ 300-304 (lines=5) @@
297
            }
298
        }
299
300
        if (!$this->resourceClassResolver->isResourceClass($className) || $propertyMetadata->isWritableLink()) {
301
            $context['resource_class'] = $className;
302
303
            return $this->serializer->denormalize($value, $className, $format, $context);
304
        }
305
306
        if (!is_array($value)) {
307
            // repeat the code so that IRIs keep working with the json format