Skip to content

Commit ea5566b

Browse files
committed
Simplify fetching requires header values
1 parent b9d1d77 commit ea5566b

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/Plugin_Command.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -986,23 +986,11 @@ public function get( $args, $assoc_args ) {
986986
'version' => $plugin_data['Version'],
987987
'description' => wordwrap( $plugin_data['Description'] ),
988988
'status' => $this->get_status( $file ),
989-
'requires_wp' => '',
990-
'requires_php' => '',
991-
'requires_plugins' => '',
989+
'requires_wp' => ! empty( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : '',
990+
'requires_php' => ! empty( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : '',
991+
'requires_plugins' => ! empty( $plugin_data['RequiresPlugins'] ) ? $plugin_data['RequiresPlugins'] : '',
992992
];
993993

994-
$require_fields = [
995-
'requires_wp' => 'RequiresWP',
996-
'requires_php' => 'RequiresPHP',
997-
'requires_plugins' => 'RequiresPlugins',
998-
];
999-
1000-
foreach ( $require_fields as $field_key => $data_key ) {
1001-
if ( isset( $plugin_data[ $data_key ] ) && ! empty( $plugin_data[ $data_key ] ) ) {
1002-
$plugin_obj->{$field_key} = $plugin_data[ $data_key ];
1003-
}
1004-
}
1005-
1006994
if ( empty( $assoc_args['fields'] ) ) {
1007995
$assoc_args['fields'] = $default_fields;
1008996
}

0 commit comments

Comments
 (0)