Code Duplication    Length = 15-16 lines in 2 locations

src/SiteAliasFileLoader.php 2 locations

@@ 180-194 (lines=15) @@
177
     * @param string $sitename The site name to return all environments for.
178
     * @return SiteAlias[]|false
179
     */
180
    public function loadMultiple($sitename, $location = null)
181
    {
182
        $result = [];
183
        foreach ($this->discovery()->filterByLocation($location)->find($sitename) as $path) {
184
            if ($siteData = $this->loadSiteDataFromPath($path)) {
185
                $location = SiteAliasName::locationFromPath($path);
186
                // Convert the raw array into a list of alias records.
187
                $result = array_merge(
188
                    $result,
189
                    $this->createSiteAliassFromSiteData($sitename, $siteData, $location)
190
                );
191
            }
192
        }
193
        return $result;
194
    }
195
196
    /**
197
     * Given a location, return all alias files located there.
@@ 202-217 (lines=16) @@
199
     * @param string $location The location to filter.
200
     * @return SiteAlias[]
201
     */
202
    public function loadLocation($location)
203
    {
204
        $result = [];
205
        foreach ($this->listAll($location) as $path) {
206
            if ($siteData = $this->loadSiteDataFromPath($path)) {
207
                $location = SiteAliasName::locationFromPath($path);
208
                $sitename = $this->siteNameFromPath($path);
209
                // Convert the raw array into a list of alias records.
210
                $result = array_merge(
211
                    $result,
212
                    $this->createSiteAliassFromSiteData($sitename, $siteData, $location)
213
                );
214
            }
215
        }
216
        return $result;
217
    }
218
219
    /**
220
     * @param array $siteData list of sites with its respective data