Code Duplication    Length = 13-13 lines in 2 locations

src/Models/MetadataTrait.php 2 locations

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