Code Duplication    Length = 9-12 lines in 2 locations

src/Relations/BelongsTo.php 1 location

@@ 58-69 (lines=12) @@
55
     * @param RecordCollection $collection
56
     * @return array
57
     */
58
    protected function buildDictionary(RecordCollection $collection)
59
    {
60
        if ($collection->isEmpty()) {
61
            return [];
62
        }
63
        $dictionary = [];
64
        foreach ($collection as $record) {
65
            $dictionary[$this->getDictionaryKey($record)] = $record;
66
        }
67
68
        return $dictionary;
69
    }
70
71
    /**
72
     * @param Record $record

src/Relations/HasOneOrMany.php 1 location

@@ 129-137 (lines=9) @@
126
     * @param RecordCollection $collection
127
     * @return array
128
     */
129
    protected function buildDictionary(RecordCollection $collection)
130
    {
131
        $dictionary = [];
132
        $pk = $this->getDictionaryKey();
133
        foreach ($collection as $record) {
134
            $dictionary[$record->{$pk}][] = $record;
135
        }
136
        return $dictionary;
137
    }
138
139
    /**
140
     * @return string