Code Duplication    Length = 5-5 lines in 2 locations

src/ActiveQuery.php 1 location

@@ 306-310 (lines=5) @@
303
            $modelClass::populateRecord($model, $row);
304
            $this->populateJoinedRelations($model, $row);
305
            if ($this->indexBy) {
306
                if ($this->indexBy instanceof \Closure) {
307
                    $key = call_user_func($this->indexBy, $model);
308
                } else {
309
                    $key = $model->{$this->indexBy};
310
                }
311
                $models[$key] = $model;
312
            } else {
313
                $models[] = $model;

src/Query.php 1 location

@@ 90-94 (lines=5) @@
87
        if (!empty($rows) && $this->indexBy !== null) {
88
            $result = [];
89
            foreach ($rows as $row) {
90
                if ($this->indexBy instanceof \Closure) {
91
                    $key = call_user_func($this->indexBy, $row);
92
                } else {
93
                    $key = $row[$this->indexBy];
94
                }
95
                $result[$key] = $row;
96
            }
97
            $rows = $result;