Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

@@ 118-130 (lines=13) @@
115
        $metadata = \App::make('metadata');
116
        $rel = $this->getRelationshipsFromMethods();
117
        $thisClass = get_class($this);
118
        foreach ($rel["HasOne"] as $n => $r) {
119
            if ($r[0] == "\\") {
120
                $r = substr($r, 1);
121
            }
122
            if (array_key_exists($r, $entityTypes)
123
                && array_key_exists($r, $resourceSets)
124
                && array_key_exists($thisClass, $entityTypes)
125
                && array_key_exists($thisClass, $resourceSets)) {
126
                $resourceType = $entityTypes[$thisClass];
127
                $targResourceSet = $resourceSets[$r];
128
                $metadata->addResourceReferenceProperty($resourceType, $n, $targResourceSet);
129
            }
130
        }
131
        foreach ($rel["HasMany"] as $n => $r) {
132
            if ($r[0] == "\\") {
133
                $r = substr($r, 1);
@@ 131-143 (lines=13) @@
128
                $metadata->addResourceReferenceProperty($resourceType, $n, $targResourceSet);
129
            }
130
        }
131
        foreach ($rel["HasMany"] as $n => $r) {
132
            if ($r[0] == "\\") {
133
                $r = substr($r, 1);
134
            }
135
            if (array_key_exists($r, $entityTypes)
136
                 && array_key_exists($r, $resourceSets)
137
                 && array_key_exists($thisClass, $entityTypes)
138
                 && array_key_exists($thisClass, $resourceSets)) {
139
                $resourceType = $entityTypes[$thisClass];
140
                $targResourceSet = $resourceSets[$r];
141
                $metadata->addResourceSetReferenceProperty($resourceType, $n, $targResourceSet);
142
            }
143
        }
144
145
        return $rel;
146
    }