You are here

public function ModuleBuildDependencies::moduleBuildDependencies in X Autoload 7.5

Parameters

object[] $files:

Return value

object[]

See also

_module_build_dependencies()

File

tests/src/VirtualDrupal/ModuleBuildDependencies.php, line 16

Class

ModuleBuildDependencies

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

public function moduleBuildDependencies($files) {
  foreach ($files as $file) {
    $graph[$file->name]['edges'] = array();
    if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) {
      foreach ($file->info['dependencies'] as $dependency) {
        $dependency_data = $this
          ->drupalParseDependency($dependency);
        $graph[$file->name]['edges'][$dependency_data['name']] = $dependency_data;
      }
    }
  }
  $this
    ->drupalDepthFirstSearch($graph);
  foreach ($graph as $module => $data) {
    $files[$module]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array();
    $files[$module]->requires = isset($data['paths']) ? $data['paths'] : array();
    $files[$module]->sort = $data['weight'];
  }
  return $files;
}