Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

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