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 2
2
3
3
namespace Jaspaul \LaravelRollout \Console ;
4
4
5
+ use Illuminate \Support \Collection ;
5
6
use Jaspaul \LaravelRollout \FeaturePresenter ;
6
7
7
8
class ListCommand extends RolloutCommand
@@ -23,22 +24,17 @@ class ListCommand extends RolloutCommand
23
24
/**
24
25
* Returns the feature rows.
25
26
*
26
- * @return array
27
+ * @return \Illuminate\Support\Collection
27
28
* A list of features.
28
29
*/
29
- protected function getRows () : array
30
+ protected function getRows () : Collection
30
31
{
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
+ });
42
38
}
43
39
44
40
/**
You can’t perform that action at this time.
0 commit comments