Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

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