Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

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