original_string: public static function load_template_with_dependencies(
          string $component,
          string $template,
          string $themename,
          bool $includecomments = false,
          string $lang = null
      ) {
          global $DB, $CFG, $PAGE;
  
          $params = self::validate_parameters(
              self::load_template_with_dependencies_parameters(),
              [
                  'component' => $component,
                  'template' => $template,
                  'themename' => $themename,
                  'includecomments' => $includecomments,
                  'lang' => $lang
              ]
          );
  
          $loader = new mustache_template_source_loader();
          // Will throw exceptions if the template does not exist.
          $dependencies = $loader->load_with_dependencies(
              $params['component'],
              $params['template'],
              $params['themename'],
              $params['includecomments'],
              [],
              [],
              $params['lang']
          );
          $formatdependencies = function($dependency) {
              $results = [];
              foreach ($dependency as $dependencycomponent => $dependencyvalues) {
                  foreach ($dependencyvalues as $dependencyname => $dependencyvalue) {
                      array_push($results, [
                          'component' => $dependencycomponent,
                          'name' => $dependencyname,
                          'value' => $dependencyvalue
                      ]);
                  }
              }
              return $results;
          };
  
          // Now we have to unpack the dependencies into a format that can be returned
          // by external functions (because they don't support dynamic keys).
          return [
              'templates' => $formatdependencies($dependencies['templates']),
              'strings' => $formatdependencies($dependencies['strings'])
          ];
      }
code: public static function load_template_with_dependencies(
          string $component,
          string $template,
          string $themename,
          bool $includecomments = false,
          string $lang = null
      ) {
          global $DB, $CFG, $PAGE;
  
          $params = self::validate_parameters(
              self::load_template_with_dependencies_parameters(),
              [
                  'component' => $component,
                  'template' => $template,
                  'themename' => $themename,
                  'includecomments' => $includecomments,
                  'lang' => $lang
              ]
          );
  
          $loader = new mustache_template_source_loader();
          // Will throw exceptions if the template does not exist.
          $dependencies = $loader->load_with_dependencies(
              $params['component'],
              $params['template'],
              $params['themename'],
              $params['includecomments'],
              [],
              [],
              $params['lang']
          );
          $formatdependencies = function($dependency) {
              $results = [];
              foreach ($dependency as $dependencycomponent => $dependencyvalues) {
                  foreach ($dependencyvalues as $dependencyname => $dependencyvalue) {
                      array_push($results, [
                          'component' => $dependencycomponent,
                          'name' => $dependencyname,
                          'value' => $dependencyvalue
                      ]);
                  }
              }
              return $results;
          };
  
          // Now we have to unpack the dependencies into a format that can be returned
          // by external functions (because they don't support dynamic keys).
          return [
              'templates' => $formatdependencies($dependencies['templates']),
              'strings' => $formatdependencies($dependencies['strings'])
          ];
      }
code_tokens: public static function load_template_with_dependencies ( string $ component , string $ template , string $ themename , bool $ includecomments = false , string $ lang = null ) { global $ DB , $ CFG , $ PAGE ; $ params = self :: validate_parameters ( self :: load_template_with_dependencies_parameters ( ) , [ 'component' => $ component , 'template' => $ template , 'themename' => $ themename , 'includecomments' => $ includecomments , 'lang' => $ lang ] ) ; $ loader = new mustache_template_source_loader ( ) ; // Will throw exceptions if the template does not exist. $ dependencies = $ loader -> load_with_dependencies ( $ params [ 'component' ] , $ params [ 'template' ] , $ params [ 'themename' ] , $ params [ 'includecomments' ] , [ ] , [ ] , $ params [ 'lang' ] ) ; $ formatdependencies = function ( $ dependency ) { $ results = [ ] ; foreach ( $ dependency as $ dependencycomponent => $ dependencyvalues ) { foreach ( $ dependencyvalues as $ dependencyname => $ dependencyvalue ) { array_push ( $ results , [ 'component' => $ dependencycomponent , 'name' => $ dependencyname , 'value' => $ dependencyvalue ] ) ; } } return $ results ; } ; // Now we have to unpack the dependencies into a format that can be returned // by external functions (because they don't support dynamic keys). return [ 'templates' => $ formatdependencies ( $ dependencies [ 'templates' ] ) , 'strings' => $ formatdependencies ( $ dependencies [ 'strings' ] ) ] ; }
docstring: Return a mustache template, and all the child templates and strings it requires.
  
  @param string $component The component that holds the template.
  @param string $template The name of the template.
  @param string $themename The name of the current theme.
  @param bool $includecomments Whether to strip comments from the template source.
  @param string $lang moodle translation language, null means use current.
  @return string the template
docstring_tokens: Return a mustache template and all the child templates and strings it requires .