Task/Generate/FileAssembler.php
protected function collectFiles(ComponentCollection $component_collection) {
    $file_info = array();

    // Components which provide a file should have registered themselves as
    // children of the root component.
    $file_components = $component_collection->getContainmentTreeChildren($component_collection->getRootComponent());
    foreach ($file_components as $id => $child_component) {
      // Don't get files for existing components.
      // TODO! This is quick and dirty! It's a lot more complicated than this,
      // for instance with components that affect other files.
      // Currently the only component that will set this is Info, to make
      // adding code to existing modules look like it works!
      if ($child_component->exists) {
        continue;
      }

      $file_info_item = $child_component->getFileInfo();
      if (is_array($file_info_item)) {
        // Prepend the component_base_path to the path.
        if (!empty($child_component->component_data['component_base_path'])) {
          if (empty($file_info_item['path'])) {
            $file_info_item['path'] = $child_component->component_data['component_base_path'];
          }
          else {
            $file_info_item['path'] = $child_component->component_data['component_base_path']
              . '/'
              . $file_info_item['path'];
          }
        }

        // Add the source component ID.
        $file_info_item['source_component_id'] = $id;

        $file_info[$id] = $file_info_item;
      }
    }

    return $file_info;
  }
protected function collectFiles(ComponentCollection $component_collection) {
    $file_info = array();

    // Components which provide a file should have registered themselves as
    // children of the root component.
    $file_components = $component_collection->getContainmentTreeChildren($component_collection->getRootComponent());
    foreach ($file_components as $id => $child_component) {
      // Don't get files for existing components.
      // TODO! This is quick and dirty! It's a lot more complicated than this,
      // for instance with components that affect other files.
      // Currently the only component that will set this is Info, to make
      // adding code to existing modules look like it works!
      if ($child_component->exists) {
        continue;
      }

      $file_info_item = $child_component->getFileInfo();
      if (is_array($file_info_item)) {
        // Prepend the component_base_path to the path.
        if (!empty($child_component->component_data['component_base_path'])) {
          if (empty($file_info_item['path'])) {
            $file_info_item['path'] = $child_component->component_data['component_base_path'];
          }
          else {
            $file_info_item['path'] = $child_component->component_data['component_base_path']
              . '/'
              . $file_info_item['path'];
          }
        }

        // Add the source component ID.
        $file_info_item['source_component_id'] = $id;

        $file_info[$id] = $file_info_item;
      }
    }

    return $file_info;
  }
protected function collectFiles ( ComponentCollection $ component_collection ) { $ file_info = array ( ) ; // Components which provide a file should have registered themselves as // children of the root component. $ file_components = $ component_collection -> getContainmentTreeChildren ( $ component_collection -> getRootComponent ( ) ) ; foreach ( $ file_components as $ id => $ child_component ) { // Don't get files for existing components. // TODO! This is quick and dirty! It's a lot more complicated than this, // for instance with components that affect other files. // Currently the only component that will set this is Info, to make // adding code to existing modules look like it works! if ( $ child_component -> exists ) { continue ; } $ file_info_item = $ child_component -> getFileInfo ( ) ; if ( is_array ( $ file_info_item ) ) { // Prepend the component_base_path to the path. if ( ! empty ( $ child_component -> component_data [ 'component_base_path' ] ) ) { if ( empty ( $ file_info_item [ 'path' ] ) ) { $ file_info_item [ 'path' ] = $ child_component -> component_data [ 'component_base_path' ] ; } else { $ file_info_item [ 'path' ] = $ child_component -> component_data [ 'component_base_path' ] . '/' . $ file_info_item [ 'path' ] ; } } // Add the source component ID. $ file_info_item [ 'source_component_id' ] = $ id ; $ file_info [ $ id ] = $ file_info_item ; } } return $ file_info ; }
Collect file data from components.

This assembles an array, keyed by an arbitrary ID for the file, whose
values are arrays with the following properties:
- 'body': An array of lines of content for the file.
- 'path': The path for the file, relative to the module folder.
- 'filename': The filename for the file.

@param $component_list
The component list.

@return
An array of file info, keyed by arbitrary file ID.
Collect file data from components .