Code Duplication    Length = 9-9 lines in 6 locations

src/Metadata/EntityMetadata.php 3 locations

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

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->type);
93
        }
94
        if (true === $this->hasEmbed($attribute->getKey())) {
95
            throw MetadataException::fieldKeyInUse('attribute', 'embed', $attribute->getKey(), $this->type);
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->type);
106
        }
107
        if (true === $this->hasRelationship($embed->getKey())) {
108
            throw MetadataException::fieldKeyInUse('embed', 'relationship', $embed->getKey(), $this->type);
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->type);
119
        }
120
        if (true === $this->hasEmbed($relationship->getKey())) {
121
            throw MetadataException::fieldKeyInUse('relationship', 'embed', $relationship->getKey(), $this->type);
122
        }
123
    }
124
}
125