Code Duplication    Length = 15-15 lines in 2 locations

src/Collection/LazyModelCollection.php 1 location

@@ 71-85 (lines=15) @@
68
     *
69
     * @return ModelInterface[]|array
70
     */
71
    private function modelsWithIdKey(array $models): array
72
    {
73
        $modelsWithIdKey = [];
74
        foreach ($models as $model) {
75
            if (!$model instanceof ModelInterface) {
76
                throw new \InvalidArgumentException(
77
                    sprintf('Model with index %d needs to implement: %s', ModelInterface::class)
78
                );
79
            }
80
81
            $modelsWithIdKey[$model->getId()] = $model;
82
        }
83
84
        return $modelsWithIdKey;
85
    }
86
87
    /**
88
     * @return ModelInterface

src/Collection/ModelCollection.php 1 location

@@ 43-57 (lines=15) @@
40
     *
41
     * @return ModelInterface[]|array
42
     */
43
    private function modelsWithIdKey(array $models): array
44
    {
45
        $modelsWithIdKey = [];
46
        foreach ($models as $model) {
47
            if (!$model instanceof ModelInterface) {
48
                throw new \InvalidArgumentException(
49
                    sprintf('Model with index %d needs to implement: %s', ModelInterface::class)
50
                );
51
            }
52
53
            $modelsWithIdKey[$model->getId()] = $model;
54
        }
55
56
        return $modelsWithIdKey;
57
    }
58
59
    /**
60
     * @return ModelInterface