Code Duplication    Length = 9-9 lines in 6 locations

src/Metadata/MixinMetadata.php 3 locations

@@ 89-97 (lines=9) @@
86
    /**
87
     * {@inheritdoc}
88
     */
89
    protected function validateAttribute(AttributeMetadata $attribute)
90
    {
91
        if (true === $this->hasRelationship($attribute->getKey())) {
92
            throw MetadataException::fieldKeyInUse('attribute', 'relationship', $attribute->getKey(), $this->name);
93
        }
94
        if (true === $this->hasEmbed($attribute->getKey())) {
95
            throw MetadataException::fieldKeyInUse('attribute', 'embed', $attribute->getKey(), $this->name);
96
        }
97
    }
98
99
    /**
100
     * {@inheritdoc}
@@ 102-110 (lines=9) @@
99
    /**
100
     * {@inheritdoc}
101
     */
102
    protected function validateEmbed(EmbeddedPropMetadata $embed)
103
    {
104
        if (true === $this->hasAttribute($embed->getKey())) {
105
            throw MetadataException::fieldKeyInUse('embed', 'attribute', $embed->getKey(), $this->name);
106
        }
107
        if (true === $this->hasRelationship($embed->getKey())) {
108
            throw MetadataException::fieldKeyInUse('embed', 'relationship', $embed->getKey(), $this->name);
109
        }
110
    }
111
112
    /**
113
     * {@inheritdoc}
@@ 115-123 (lines=9) @@
112
    /**
113
     * {@inheritdoc}
114
     */
115
    protected function validateRelationship(RelationshipMetadata $relationship)
116
    {
117
        if (true === $this->hasAttribute($relationship->getKey())) {
118
            throw MetadataException::fieldKeyInUse('relationship', 'attribute', $relationship->getKey(), $this->name);
119
        }
120
        if (true === $this->hasEmbed($relationship->getKey())) {
121
            throw MetadataException::fieldKeyInUse('relationship', 'embed', $relationship->getKey(), $this->name);
122
        }
123
    }
124
}
125

src/Metadata/EntityMetadata.php 3 locations

@@ 301-309 (lines=9) @@
298
    /**
299
     * {@inheritdoc}
300
     */
301
    protected function validateAttribute(AttributeMetadata $attribute)
302
    {
303
        if (true === $this->hasRelationship($attribute->getKey())) {
304
            throw MetadataException::fieldKeyInUse('attribute', 'relationship', $attribute->getKey(), $this->type);
305
        }
306
        if (true === $this->hasEmbed($attribute->getKey())) {
307
            throw MetadataException::fieldKeyInUse('attribute', 'embed', $attribute->getKey(), $this->type);
308
        }
309
    }
310
311
    /**
312
     * {@inheritdoc}
@@ 314-322 (lines=9) @@
311
    /**
312
     * {@inheritdoc}
313
     */
314
    protected function validateEmbed(EmbeddedPropMetadata $embed)
315
    {
316
        if (true === $this->hasAttribute($embed->getKey())) {
317
            throw MetadataException::fieldKeyInUse('embed', 'attribute', $embed->getKey(), $this->type);
318
        }
319
        if (true === $this->hasRelationship($embed->getKey())) {
320
            throw MetadataException::fieldKeyInUse('embed', 'relationship', $embed->getKey(), $this->type);
321
        }
322
    }
323
324
    /**
325
     * {@inheritdoc}
@@ 327-335 (lines=9) @@
324
    /**
325
     * {@inheritdoc}
326
     */
327
    protected function validateRelationship(RelationshipMetadata $relationship)
328
    {
329
        if (true === $this->hasAttribute($relationship->getKey())) {
330
            throw MetadataException::fieldKeyInUse('relationship', 'attribute', $relationship->getKey(), $this->type);
331
        }
332
        if (true === $this->hasEmbed($relationship->getKey())) {
333
            throw MetadataException::fieldKeyInUse('relationship', 'embed', $relationship->getKey(), $this->type);
334
        }
335
    }
336
337
    /**
338
     * Merges attributes with this instance's attributes.