Code Duplication    Length = 21-21 lines in 2 locations

src/Metadata/MixinMetadata.php 1 location

@@ 64-84 (lines=21) @@
61
    /**
62
     * {@inheritdoc}
63
     */
64
    protected function applyMixinProperties(MixinMetadata $mixin)
65
    {
66
        foreach ($mixin->getAttributes() as $attribute) {
67
            if (true === $this->hasAttribute($attribute->key)) {
68
                throw MetadataException::mixinPropertyExists($this->name, $mixin->name, 'attribute', $attribute->key);
69
            }
70
            $this->addAttribute($attribute);
71
        }
72
        foreach ($mixin->getRelationships() as $relationship) {
73
            if (true === $this->hasRelationship($relationship->key)) {
74
                throw MetadataException::mixinPropertyExists($this->name, $mixin->name, 'relationship', $relationship->key);
75
            }
76
            $this->addRelationship($relationship);
77
        }
78
        foreach ($mixin->getEmbeds() as $embed) {
79
            if (true === $this->hasEmbed($embed->key)) {
80
                throw MetadataException::mixinPropertyExists($this->name, $mixin->name, 'embed', $embed->key);
81
            }
82
            $this->addEmbed($embed);
83
        }
84
    }
85
86
    /**
87
     * {@inheritdoc}

src/Metadata/EntityMetadata.php 1 location

@@ 276-296 (lines=21) @@
273
    /**
274
     * {@inheritdoc}
275
     */
276
    protected function applyMixinProperties(MixinMetadata $mixin)
277
    {
278
        foreach ($mixin->getAttributes() as $attribute) {
279
            if (true === $this->hasAttribute($attribute->key)) {
280
                throw MetadataException::mixinPropertyExists($this->type, $mixin->name, 'attribute', $attribute->key);
281
            }
282
            $this->addAttribute($attribute);
283
        }
284
        foreach ($mixin->getRelationships() as $relationship) {
285
            if (true === $this->hasRelationship($relationship->key)) {
286
                throw MetadataException::mixinPropertyExists($this->type, $mixin->name, 'relationship', $relationship->key);
287
            }
288
            $this->addRelationship($relationship);
289
        }
290
        foreach ($mixin->getEmbeds() as $embed) {
291
            if (true === $this->hasEmbed($embed->key)) {
292
                throw MetadataException::mixinPropertyExists($this->type, $mixin->name, 'embed', $embed->key);
293
            }
294
            $this->addEmbed($embed);
295
        }
296
    }
297
298
    /**
299
     * {@inheritdoc}