Factory.php
public static function getTask($task_type, $task_options = NULL) {
    if (!isset(self::$environment)) {
      throw new \Exception("Environment not set.");
    }

    $task_class = self::getTaskClass($task_type);

    // Set the environment handler on the task handler too.
    $task_handler = new $task_class(self::$environment, $task_options);

    // Find out what sanity level the task handler needs.
    $required_sanity = $task_handler->getSanityLevel();
    //dsm($required_sanity);

    // Check the environment for the required sanity level.
    self::$environment->verifyEnvironment($required_sanity);

    return $task_handler;
  }
public static function getTask($task_type, $task_options = NULL) {
    if (!isset(self::$environment)) {
      throw new \Exception("Environment not set.");
    }

    $task_class = self::getTaskClass($task_type);

    // Set the environment handler on the task handler too.
    $task_handler = new $task_class(self::$environment, $task_options);

    // Find out what sanity level the task handler needs.
    $required_sanity = $task_handler->getSanityLevel();
    //dsm($required_sanity);

    // Check the environment for the required sanity level.
    self::$environment->verifyEnvironment($required_sanity);

    return $task_handler;
  }
public static function getTask ( $ task_type , $ task_options = NULL ) { if ( ! isset ( self :: $ environment ) ) { throw new \ Exception ( "Environment not set." ) ; } $ task_class = self :: getTaskClass ( $ task_type ) ; // Set the environment handler on the task handler too. $ task_handler = new $ task_class ( self :: $ environment , $ task_options ) ; // Find out what sanity level the task handler needs. $ required_sanity = $ task_handler -> getSanityLevel ( ) ; //dsm($required_sanity); // Check the environment for the required sanity level. self :: $ environment -> verifyEnvironment ( $ required_sanity ) ; return $ task_handler ; }
Get a new task handler.

This creates a new task handler object as requested, sets the environment
handler on it, then checks the environment for the environment level the
task declares that it needs.

@param $task_type
The type of task. This should the the name of a class in the
DrupalCodeBuilder\Task namespace, without the Drupal core version suffix.
May be one of:
- 'Collect': Collect and process data on available hooks.
- 'ReportHookData':
- ... others TODO.
@param $task_options
(optional) A further parameter to pass to the task's constructor. Its
nature (or necessity) depends on the task.

@return
A new task handler object, which implements DrupalCodeBuilderTaskInterface.

@throws \DrupalCodeBuilder\Exception\SanityException
Throws an exception if the environment is not in a state that is ready for
the requested task, for example, if no hook data has been downloaded.
Get a new task handler .