original_string: protected function format_metadata($collection, $component, $internaldata) {
          foreach ($collection as $collectioninfo) {
              $privacyfields = $collectioninfo->get_privacy_fields();
              $fields = '';
              if (!empty($privacyfields)) {
                  $fields = array_map(function($key, $field) use ($component) {
                      return [
                          'field_name' => $key,
                          'field_summary' => get_string($field, $component)
                      ];
                  }, array_keys($privacyfields), $privacyfields);
              }
              // Can the metadata types be located somewhere else besides core?
              $items = explode('\\', get_class($collectioninfo));
              $type = array_pop($items);
              $typedata = [
                  'name' => $collectioninfo->get_name(),
                  'type' => $type,
                  'fields' => $fields,
                  'summary' => get_string($collectioninfo->get_summary(), $component)
              ];
              if (strpos($type, 'subsystem_link') === 0 || strpos($type, 'plugintype_link') === 0) {
                  $typedata['link'] = true;
              }
              $internaldata['metadata'][] = $typedata;
          }
          return $internaldata;
      }
code: protected function format_metadata($collection, $component, $internaldata) {
          foreach ($collection as $collectioninfo) {
              $privacyfields = $collectioninfo->get_privacy_fields();
              $fields = '';
              if (!empty($privacyfields)) {
                  $fields = array_map(function($key, $field) use ($component) {
                      return [
                          'field_name' => $key,
                          'field_summary' => get_string($field, $component)
                      ];
                  }, array_keys($privacyfields), $privacyfields);
              }
              // Can the metadata types be located somewhere else besides core?
              $items = explode('\\', get_class($collectioninfo));
              $type = array_pop($items);
              $typedata = [
                  'name' => $collectioninfo->get_name(),
                  'type' => $type,
                  'fields' => $fields,
                  'summary' => get_string($collectioninfo->get_summary(), $component)
              ];
              if (strpos($type, 'subsystem_link') === 0 || strpos($type, 'plugintype_link') === 0) {
                  $typedata['link'] = true;
              }
              $internaldata['metadata'][] = $typedata;
          }
          return $internaldata;
      }
code_tokens: protected function format_metadata ( $ collection , $ component , $ internaldata ) { foreach ( $ collection as $ collectioninfo ) { $ privacyfields = $ collectioninfo -> get_privacy_fields ( ) ; $ fields = '' ; if ( ! empty ( $ privacyfields ) ) { $ fields = array_map ( function ( $ key , $ field ) use ( $ component ) { return [ 'field_name' => $ key , 'field_summary' => get_string ( $ field , $ component ) ] ; } , array_keys ( $ privacyfields ) , $ privacyfields ) ; } // Can the metadata types be located somewhere else besides core? $ items = explode ( '\\' , get_class ( $ collectioninfo ) ) ; $ type = array_pop ( $ items ) ; $ typedata = [ 'name' => $ collectioninfo -> get_name ( ) , 'type' => $ type , 'fields' => $ fields , 'summary' => get_string ( $ collectioninfo -> get_summary ( ) , $ component ) ] ; if ( strpos ( $ type , 'subsystem_link' ) === 0 || strpos ( $ type , 'plugintype_link' ) === 0 ) { $ typedata [ 'link' ] = true ; } $ internaldata [ 'metadata' ] [ ] = $ typedata ; } return $ internaldata ; }
docstring: Formats the metadata for use with a template.
  
  @param  array $collection The collection associated with the component that we want to expand and format.
  @param  string $component The component that we are dealing in
  @param  array $internaldata The array to add the formatted metadata to.
  @return array The internal data array with the formatted metadata.
docstring_tokens: Formats the metadata for use with a template .