Code Duplication    Length = 14-14 lines in 2 locations

src/Package/PackageCollection.php 2 locations

@@ 79-92 (lines=14) @@
76
    /**
77
     * @return array
78
     */
79
    private function getIndexedByName(): array
80
    {
81
        if (!empty($this->indexedBy['name'])) {
82
            return $this->indexedBy['name'];
83
        }
84
        /** @var Package $package */
85
        foreach($this->getArrayCopy() as $package) {
86
            if (!($package instanceof Package)) {
87
                continue;
88
            }
89
            $this->indexedBy['name'][$package->getName()] = $package;
90
        }
91
        return $this->indexedBy['name'];
92
    }
93
94
    /**
95
     * @return array
@@ 97-110 (lines=14) @@
94
    /**
95
     * @return array
96
     */
97
    private function getIndexedByNamespace(): array
98
    {
99
        if (!empty($this->indexedBy['namespace'])) {
100
            return $this->indexedBy['namespace'];
101
        }
102
        /** @var Package $package */
103
        foreach($this->getArrayCopy() as $package) {
104
            if (!($package instanceof Package)) {
105
                continue;
106
            }
107
            $this->indexedBy['namespace'][$package->getNamespace()] = $package;
108
        }
109
        return $this->indexedBy['namespace'];
110
    }
111
}
112