protected function addTaskToStage($tasks, $stage, Application $application = null, $step = 'tasks')
    {
        if (!is_array($tasks)) {
            $tasks = [$tasks];
        }

        $applicationName = $application !== null ? $application->getName() : '_';

        if (!isset($this->tasks['stage'][$applicationName][$stage][$step])) {
            $this->tasks['stage'][$applicationName][$stage][$step] = [];
        }

        $this->tasks['stage'][$applicationName][$stage][$step] = array_merge($this->tasks['stage'][$applicationName][$stage][$step], $tasks);
    }
protected function addTaskToStage($tasks, $stage, Application $application = null, $step = 'tasks')
    {
        if (!is_array($tasks)) {
            $tasks = [$tasks];
        }

        $applicationName = $application !== null ? $application->getName() : '_';

        if (!isset($this->tasks['stage'][$applicationName][$stage][$step])) {
            $this->tasks['stage'][$applicationName][$stage][$step] = [];
        }

        $this->tasks['stage'][$applicationName][$stage][$step] = array_merge($this->tasks['stage'][$applicationName][$stage][$step], $tasks);
    }
protected function addTaskToStage ( $ tasks , $ stage , Application $ application = null , $ step = 'tasks' ) { if ( ! is_array ( $ tasks ) ) { $ tasks = [ $ tasks ] ; } $ applicationName = $ application !== null ? $ application -> getName ( ) : '_' ; if ( ! isset ( $ this -> tasks [ 'stage' ] [ $ applicationName ] [ $ stage ] [ $ step ] ) ) { $ this -> tasks [ 'stage' ] [ $ applicationName ] [ $ stage ] [ $ step ] = [ ] ; } $ this -> tasks [ 'stage' ] [ $ applicationName ] [ $ stage ] [ $ step ] = array_merge ( $ this -> tasks [ 'stage' ] [ $ applicationName ] [ $ stage ] [ $ step ] , $ tasks ) ; }
Add the given tasks to a step in a stage and optionally a specific application

The tasks will be executed for the given stage. If an application is given,
the tasks will be executed only for the stage and application.

@param array|string $tasks
@param string $stage The name of the stage when this task shall be executed
@param \TYPO3\Surf\Domain\Model\Application $application If given the task will be specific for this application
@param string $step A stage has three steps "before", "tasks" and "after"
Add the given tasks to a step in a stage and optionally a specific application