From 6d8a00097618790d2651fa7c56554f607e094c03 Mon Sep 17 00:00:00 2001 From: Brady Vercher Date: Wed, 25 Sep 2019 12:20:48 -0700 Subject: [PATCH] Remove array keys in package repositories. Fixes #109 When merging repositories in the MultiRepository, a theme and plugin with the same slug would create a conflict. The keys aren't exposed outside of the repository objects and weren't used internally. --- src/Repository/FilteredRepository.php | 2 +- src/Repository/InstalledPlugins.php | 2 +- src/Repository/InstalledThemes.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Repository/FilteredRepository.php b/src/Repository/FilteredRepository.php index 5a6cd41..a625cd9 100644 --- a/src/Repository/FilteredRepository.php +++ b/src/Repository/FilteredRepository.php @@ -58,7 +58,7 @@ public function all(): array { foreach ( $this->repository->all() as $package ) { if ( ( $this->callback )( $package ) ) { - $packages[ $package->get_slug() ] = $package; + $packages[] = $package; } } diff --git a/src/Repository/InstalledPlugins.php b/src/Repository/InstalledPlugins.php index 484614e..a007ba4 100644 --- a/src/Repository/InstalledPlugins.php +++ b/src/Repository/InstalledPlugins.php @@ -52,7 +52,7 @@ public function all(): array { foreach ( get_plugins() as $plugin_file => $plugin_data ) { $package = $this->build( $plugin_file, $plugin_data ); $slug = $package->get_slug(); - $items[ $slug ] = $package; + $items[] = $package; } ksort( $items ); diff --git a/src/Repository/InstalledThemes.php b/src/Repository/InstalledThemes.php index e0a25d8..1027b09 100644 --- a/src/Repository/InstalledThemes.php +++ b/src/Repository/InstalledThemes.php @@ -51,7 +51,7 @@ public function all(): array { $items = []; foreach ( wp_get_themes() as $slug => $theme ) { - $items[ $slug ] = $this->build( $slug, $theme ); + $items[] = $this->build( $slug, $theme ); } return $items;