Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

@@ 148-160 (lines=13) @@
145
        $metadata = \App::make('metadata');
146
        $rel = $this->getRelationshipsFromMethods();
147
        $thisClass = get_class($this);
148
        foreach ($rel["HasOne"] as $n => $r) {
149
            if ($r[0] == "\\") {
150
                $r = substr($r, 1);
151
            }
152
            if (array_key_exists($r, $entityTypes)
153
                && array_key_exists($r, $resourceSets)
154
                && array_key_exists($thisClass, $entityTypes)
155
                && array_key_exists($thisClass, $resourceSets)) {
156
                $resourceType = $entityTypes[$thisClass];
157
                $targResourceSet = $resourceSets[$r];
158
                $metadata->addResourceReferenceProperty($resourceType, $n, $targResourceSet);
159
            }
160
        }
161
        foreach ($rel["HasMany"] as $n => $r) {
162
            if ($r[0] == "\\") {
163
                $r = substr($r, 1);
@@ 161-173 (lines=13) @@
158
                $metadata->addResourceReferenceProperty($resourceType, $n, $targResourceSet);
159
            }
160
        }
161
        foreach ($rel["HasMany"] as $n => $r) {
162
            if ($r[0] == "\\") {
163
                $r = substr($r, 1);
164
            }
165
            if (array_key_exists($r, $entityTypes)
166
                 && array_key_exists($r, $resourceSets)
167
                 && array_key_exists($thisClass, $entityTypes)
168
                 && array_key_exists($thisClass, $resourceSets)) {
169
                $resourceType = $entityTypes[$thisClass];
170
                $targResourceSet = $resourceSets[$r];
171
                $metadata->addResourceSetReferenceProperty($resourceType, $n, $targResourceSet);
172
            }
173
        }
174
175
        return $rel;
176
    }