Skip to content

Commit

Permalink
Remove array keys in package repositories. Fixes #109
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bradyvercher committed Sep 25, 2019
1 parent a9d5f35 commit 6d8a000
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Repository/FilteredRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Repository/InstalledPlugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/InstalledThemes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6d8a000

Please sign in to comment.