Code Duplication    Length = 15-15 lines in 2 locations

src/Collection/LazyModelCollection.php 1 location

@@ 51-65 (lines=15) @@
48
     *
49
     * @return ModelInterface[]|array
50
     */
51
    private function modelsWithIdKey(array $models): array
52
    {
53
        $modelsWithIdKey = [];
54
        foreach ($models as $model) {
55
            if (!$model instanceof ModelInterface) {
56
                throw new \InvalidArgumentException(
57
                    sprintf('Model with index %d needs to implement: %s', ModelInterface::class)
58
                );
59
            }
60
61
            $modelsWithIdKey[$model->getId()] = $model;
62
        }
63
64
        return $modelsWithIdKey;
65
    }
66
67
    /**
68
     * @return ModelInterface

src/Collection/ModelCollection.php 1 location

@@ 35-49 (lines=15) @@
32
     *
33
     * @return ModelInterface[]|array
34
     */
35
    private function modelsWithIdKey(array $models): array
36
    {
37
        $modelsWithIdKey = [];
38
        foreach ($models as $model) {
39
            if (!$model instanceof ModelInterface) {
40
                throw new \InvalidArgumentException(
41
                    sprintf('Model with index %d needs to implement: %s', ModelInterface::class)
42
                );
43
            }
44
45
            $modelsWithIdKey[$model->getId()] = $model;
46
        }
47
48
        return $modelsWithIdKey;
49
    }
50
51
    /**
52
     * @return ModelInterface