Code Duplication    Length = 6-6 lines in 2 locations

src/Util/EntityUtility.php 2 locations

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