File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed
Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 22
33namespace Jaspaul \LaravelRollout \Console ;
44
5+ use Illuminate \Support \Collection ;
56use Jaspaul \LaravelRollout \FeaturePresenter ;
67
78class ListCommand extends RolloutCommand
@@ -23,22 +24,17 @@ class ListCommand extends RolloutCommand
2324 /**
2425 * Returns the feature rows.
2526 *
26- * @return array
27+ * @return \Illuminate\Support\Collection
2728 * A list of features.
2829 */
29- protected function getRows () : array
30+ protected function getRows () : Collection
3031 {
31- $ rows = [];
32-
33- $ features = $ this ->rollout ->features ();
34-
35- foreach ($ features as $ name )
36- {
37- $ feature = new FeaturePresenter ($ this ->rollout ->get ($ name ));
38- $ rows [] = $ feature ->toArray ();
39- }
40-
41- return $ rows ;
32+ return (new Collection ($ this ->rollout ->features ()))
33+ ->map (function ($ feature ) {
34+ return new FeaturePresenter ($ this ->rollout ->get ($ feature ));
35+ })->map (function (FeaturePresenter $ feature ) {
36+ return $ feature ->toArray ();
37+ });
4238 }
4339
4440 /**
You can’t perform that action at this time.
0 commit comments