Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

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