Task/Generate/ComponentClassHandler.php
public function getGenerator($component_type, $component_data) {
    $class = $this->getGeneratorClass($component_type);

    if (!class_exists($class)) {
      throw new \DrupalCodeBuilder\Exception\InvalidInputException(strtr("Invalid component type !type.", array(
        '!type' => htmlspecialchars($component_type, ENT_QUOTES, 'UTF-8'),
      )));
    }

    $generator = new $class($component_data);

    // Quick hack for the benefit of the Hooks generator.
    $generator->classHandlerHelper = $this;

    return $generator;
  }
public function getGenerator($component_type, $component_data) {
    $class = $this->getGeneratorClass($component_type);

    if (!class_exists($class)) {
      throw new \DrupalCodeBuilder\Exception\InvalidInputException(strtr("Invalid component type !type.", array(
        '!type' => htmlspecialchars($component_type, ENT_QUOTES, 'UTF-8'),
      )));
    }

    $generator = new $class($component_data);

    // Quick hack for the benefit of the Hooks generator.
    $generator->classHandlerHelper = $this;

    return $generator;
  }
public function getGenerator ( $ component_type , $ component_data ) { $ class = $ this -> getGeneratorClass ( $ component_type ) ; if ( ! class_exists ( $ class ) ) { throw new \ DrupalCodeBuilder \ Exception \ InvalidInputException ( strtr ( "Invalid component type !type." , array ( '!type' => htmlspecialchars ( $ component_type , ENT_QUOTES , 'UTF-8' ) , ) ) ) ; } $ generator = new $ class ( $ component_data ) ; // Quick hack for the benefit of the Hooks generator. $ generator -> classHandlerHelper = $ this ; return $ generator ; }
Generator factory.

@param $component_type
The type of the component. This is use to build the class name: see
getGeneratorClass().
@param $component_data
An array of data for the component. This is passed to the generator's
__construct().

@return
A generator object, with the component name and data set on it, as well
as a reference to this task handler.

@throws \DrupalCodeBuilder\Exception\InvalidInputException
Throws an exception if the given component type does not correspond to
a component class.
Generator factory .