Code Duplication    Length = 6-6 lines in 2 locations

src/Util/EntityUtility.php 2 locations

@@ 211-216 (lines=6) @@
208
                throw MetadataException::invalidMetadata($type, sprintf('The data type "%s" for attribute "%s" is invalid', $attribute->dataType, $attribute->key));
209
            }
210
211
            if ($metadata instanceof EntityMetadata && true === $metadata->isChildEntity()) {
212
                $parent = $mf->getMetadataForType($metadata->extends);
213
                if ($parent->hasAttribute($attribute->key)) {
214
                    throw MetadataException::invalidMetadata($type, sprintf('Parent entity type "%s" already contains attribute field "%s"', $parent->type, $attribute->key));
215
                }
216
            }
217
218
            if (true === $attribute->isCalculated()) {
219
                if (false === class_exists($attribute->calculated['class']) || false === method_exists($attribute->calculated['class'], $attribute->calculated['method'])) {
@@ 260-265 (lines=6) @@
257
            if (false === $this->isFieldKeyValid($relationship->key)) {
258
                throw MetadataException::invalidMetadata($metadata->type, sprintf('The relationship key "%s" is invalid based on the configured name format "%s"', $relationship->key, $this->config->getFieldKeyFormat()));
259
            }
260
            if (true === $metadata->isChildEntity()) {
261
                $parent = $mf->getMetadataForType($metadata->extends);
262
                if ($parent->hasRelationship($relationship->key)) {
263
                    throw MetadataException::invalidMetadata($metadata->type, sprintf('Parent entity type "%s" already contains relationship field "%s"', $parent->type, $relationship->key));
264
                }
265
            }
266
            if (false === $this->isEntityTypeValid($relationship->entityType)) {
267
                throw MetadataException::invalidMetadata($metadata->type, sprintf('The related model "%s" for relationship "%s" is invalid based on the configured name format "%s"', $relationship->entityType, $relationship->key, $this->config->getEntityFormat()));
268
            }