@@ -75,25 +75,23 @@ function perflab_query_plugin_info( string $plugin_slug ) {
75
75
$ plugin_queue = perflab_get_standalone_plugins ();
76
76
77
77
// Index the plugins from the API response by their slug for efficient lookup.
78
- $ plugins_by_slug = array_column ( $ response ->plugins , null , 'slug ' );
78
+ $ all_performance_plugins = array_column ( $ response ->plugins , null , 'slug ' );
79
79
80
80
// Start processing the plugins using a queue-based approach.
81
- while ( ! empty ( $ plugin_queue ) ) {
81
+ while ( count ( $ plugin_queue ) > 0 ) { // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found
82
82
$ current_plugin_slug = array_shift ( $ plugin_queue );
83
83
84
- if ( isset ( $ plugins [ $ current_plugin_slug ] ) || ! isset ( $ plugins_by_slug [ $ current_plugin_slug ] ) ) {
84
+ if ( isset ( $ plugins [ $ current_plugin_slug ] ) || ! isset ( $ all_performance_plugins [ $ current_plugin_slug ] ) ) {
85
85
continue ;
86
86
}
87
87
88
- $ plugin_data = $ plugins_by_slug [ $ current_plugin_slug ];
88
+ $ plugin_data = $ all_performance_plugins [ $ current_plugin_slug ];
89
89
$ plugins [ $ current_plugin_slug ] = wp_array_slice_assoc ( $ plugin_data , $ fields );
90
90
91
- if ( empty ( $ plugin_data ['requires_plugins ' ] ) || ! is_array ( $ plugin_data ['requires_plugins ' ] ) ) {
92
- continue ;
93
- }
94
-
95
91
// Enqueue the required plugins slug by adding it to the queue.
96
- $ plugin_queue = array_merge ( $ plugin_queue , $ plugin_data ['requires_plugins ' ] );
92
+ if ( isset ( $ plugin_data ['requires_plugins ' ] ) && is_array ( $ plugin_data ['requires_plugins ' ] ) ) {
93
+ $ plugin_queue = array_merge ( $ plugin_queue , $ plugin_data ['requires_plugins ' ] );
94
+ }
97
95
}
98
96
99
97
set_transient ( $ transient_key , $ plugins , HOUR_IN_SECONDS );
0 commit comments