You are here

private static function Features::parseFeatureNames in Hook Update Deploy Tools 8

Same name and namespace in other branches
  1. 7 src/Features.php \HookUpdateDeployTools\Features::parseFeatureNames()

Parse requested feature names and components.

Parameters

array $feature_names: Array of feature names and/or feature names.component names

Return value

array Array structure of array( featurename => TRUE, featurename2 => array(component1, component2...), )

1 call to Features::parseFeatureNames()
Features::revert in src/Features.php
Safely revert an array of Features and provide feedback.

File

src/Features.php, line 265

Class

Features
Public method for reverting Features only if needed.

Namespace

HookUpdateDeployTools

Code

private static function parseFeatureNames($feature_names) {

  // Parse list of feature names.
  $modules = array();
  foreach ($feature_names as $feature_name) {
    $feature_name = explode('.', $feature_name);
    $module = array_shift($feature_name);
    $component = array_shift($feature_name);
    if (isset($module)) {
      if (empty($component)) {

        // Just a feature name, we need all of it's components.
        $modules[$module] = TRUE;
      }
      elseif ($modules[$module] !== TRUE) {

        // Requested a component be reverted, build array in case of multiple.
        if (!isset($modules[$module])) {
          $modules[$module] = array();
        }
        $modules[$module][] = $component;
      }
    }
  }
  return $modules;
}