Automattic\WooCommerce\Database\Migrations\CustomOrderTable

CLIRunner::get_printable_plugin_names()privateWC 1.0

Get the printable names for a set of plugins given their file names.

Method of the class: CLIRunner{}

No Hooks.

Return

Array. A sorted array of plugin names or file names.

Usage

// private - for code of main (parent) class only
$result = $this->get_printable_plugin_names( $plugins, $display_filenames ): array;
$plugins(array) (required)
The plugin file names.
$display_filenames(true|false) (required)
True to simply return the sorted list of plugin file names.

CLIRunner::get_printable_plugin_names() code WC 9.7.1

private function get_printable_plugin_names( array $plugins, bool $display_filenames ): array {
	if ( $display_filenames ) {
		sort( $plugins );
		return $plugins;
	}

	$plugin_names = array_map(
		fn( $plugin_file ) => get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_file, false )['Name'] ?? $plugin_file,
		$plugins
	);
	sort( $plugin_names );
	return $plugin_names;
}