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'])) {
@@ 263-268 (lines=6) @@
260
            if (false === $this->isFieldKeyValid($relationship->key)) {
261
                throw MetadataException::invalidMetadata($metadata->type, sprintf('The relationship key "%s" is invalid based on the configured name format "%s"', $relationship->key, $this->config->getFieldKeyFormat()));
262
            }
263
            if (true === $metadata->isChildEntity()) {
264
                $parent = $mf->getMetadataForType($metadata->extends);
265
                if ($parent->hasRelationship($relationship->key)) {
266
                    throw MetadataException::invalidMetadata($metadata->type, sprintf('Parent entity type "%s" already contains relationship field "%s"', $parent->type, $relationship->key));
267
                }
268
            }
269
            if (false === $this->isEntityTypeValid($relationship->entityType)) {
270
                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()));
271
            }