function _convert_csv_to_array

8.0.x drush.inc _convert_csv_to_array($args)
6.x drush.inc _convert_csv_to_array($args)
7.x drush.inc _convert_csv_to_array($args)
4.x drush.inc _convert_csv_to_array($args)
5.x drush.inc _convert_csv_to_array($args)
master drush.inc _convert_csv_to_array($args)

Convert a csv string, or an array of items which may contain csv strings, into an array of items.

@returns array A simple list of items (e.g. array('a','b','c')

Parameters

$args: A simple csv string; e.g. 'a,b,c' or a simple list of items; e.g. array('a','b','c') or some combination; e.g. array('a,b','c') or array('a,','b,','c,')

10 calls to _convert_csv_to_array()
core_cli_bashrc in commands/core/core.drush.inc
drush_pm_disable in commands/pm/pm.drush.inc
Command callback. Disable one or more extensions.
drush_pm_download in commands/pm/pm.drush.inc
Command callback. Download Drupal core or any project.
drush_pm_enable_validate in commands/pm/pm.drush.inc
Validate callback. Determine the modules and themes that the user would like enabled.
drush_pm_info in commands/pm/pm.drush.inc
Command callback. Show detailed info for one or more extension.

... See full list

File

includes/drush.inc, line 322
The drush API implementation and helpers.

Code

function _convert_csv_to_array($args) {
  //
  // Step 1: implode(',',$args) converts from, say, array('a,','b,','c,') to 'a,,b,,c,'
  // Step 2: explode(',', ...) converts to array('a','','b','','c','')
  // Step 3: array_filter(...) removes the empty items
  //
  return array_filter(explode(',', is_array($args) ? implode(',', $args) : $args));
}