@@ -28,6 +28,8 @@ class ShowStatus implements ProcessInterface
28
28
29
29
const FILTER_OPTION_ALL = 'All ' ;
30
30
31
+ const FORMAT_JSON = 'json ' ;
32
+
31
33
/**
32
34
* @var Aggregator
33
35
*/
@@ -103,31 +105,31 @@ public function __construct(
103
105
*/
104
106
public function run (InputInterface $ input , OutputInterface $ output )
105
107
{
106
- if ($ input ->getOption ('format ' ) !== 'json ' ) {
107
- $ this ->printDetailsInfo ($ output );
108
- $ this ->reviewAppliedAction ->execute ($ input , $ output , []);
109
- }
110
-
111
-
108
+ $ isJsonFormat = $ input ->getOption ('format ' ) === self ::FORMAT_JSON ;
112
109
$ patches = $ this ->aggregator ->aggregate (
113
110
array_merge ($ this ->optionalPool ->getList (), $ this ->localPool ->getList ())
114
111
);
115
112
116
- foreach ($ patches as $ patch ) {
117
- if ($ patch ->isDeprecated () && $ this ->isPatchVisible ($ patch ) && $ input ->getOption ('format ' ) !== 'json ' ) {
118
- $ this ->printDeprecatedWarning ($ output , $ patch );
113
+ if (!$ isJsonFormat ) {
114
+ $ this ->printDetailsInfo ($ output );
115
+ $ this ->reviewAppliedAction ->execute ($ input , $ output , []);
116
+ foreach ($ patches as $ patch ) {
117
+ if ($ patch ->isDeprecated () && $ this ->isPatchVisible ($ patch )) {
118
+ $ this ->printDeprecatedWarning ($ output , $ patch );
119
+ }
119
120
}
120
121
}
122
+
121
123
$ patches = $ this ->filterNotVisiblePatches ($ patches );
122
124
123
- if (count ($ patches ) > self ::INTERACTIVE_FILTER_THRESHOLD ) {
125
+ if (! $ isJsonFormat && count ($ patches ) > self ::INTERACTIVE_FILTER_THRESHOLD ) {
124
126
$ this ->printPatchProviders ($ output , $ patches );
125
127
$ patches = $ this ->filterByPatchProvider ($ input , $ output , $ patches );
126
128
$ this ->printCategoriesInfo ($ output , $ patches );
127
129
$ patches = $ this ->filterByPatchCategory ($ input , $ output , $ patches );
128
130
}
129
131
130
- if ($ input -> getOption ( ' format ' ) === ' json ' ) {
132
+ if ($ isJsonFormat ) {
131
133
$ this ->renderer ->printJson ($ output , array_values ($ patches ));
132
134
} else {
133
135
$ this ->renderer ->printTable ($ output , array_values ($ patches ));
0 commit comments