Code Duplication    Length = 15-15 lines in 2 locations

src/Collection/LazyModelCollection.php 1 location

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

src/Collection/ModelCollection.php 1 location

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