Code Duplication    Length = 21-21 lines in 2 locations

src/Metadata/EntityMetadata.php 1 location

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

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->type, $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->type, $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->type, $mixin->name, 'embed', $embed->key);
81
            }
82
            $this->addEmbed($embed);
83
        }
84
    }
85
86
    /**
87
     * {@inheritdoc}