src/Rocketeer/Services/Tasks/TasksHandler.php
public function addTaskListeners($task, $event, $listeners, $priority = 0)
    {
        // Recursive call
        if (is_array($task)) {
            foreach ($task as $t) {
                $this->addTaskListeners($t, $event, $listeners, $priority);
            }

            return;
        }

        // Cancel if no listeners
        if (!$listeners) {
            return;
        }

        // Prevent events on anonymous tasks
        $task = $this->builder->buildTask($task);
        if ($task->getSlug() === 'closure') {
            return;
        }

        // Get event name and register listeners
        $event = $this->getEventHandle($task, $event);
        $event = $this->listenTo($event, $listeners, $priority);

        return $event;
    }
public function addTaskListeners($task, $event, $listeners, $priority = 0)
    {
        // Recursive call
        if (is_array($task)) {
            foreach ($task as $t) {
                $this->addTaskListeners($t, $event, $listeners, $priority);
            }

            return;
        }

        // Cancel if no listeners
        if (!$listeners) {
            return;
        }

        // Prevent events on anonymous tasks
        $task = $this->builder->buildTask($task);
        if ($task->getSlug() === 'closure') {
            return;
        }

        // Get event name and register listeners
        $event = $this->getEventHandle($task, $event);
        $event = $this->listenTo($event, $listeners, $priority);

        return $event;
    }
public function addTaskListeners ( $ task , $ event , $ listeners , $ priority = 0 ) { // Recursive call if ( is_array ( $ task ) ) { foreach ( $ task as $ t ) { $ this -> addTaskListeners ( $ t , $ event , $ listeners , $ priority ) ; } return ; } // Cancel if no listeners if ( ! $ listeners ) { return ; } // Prevent events on anonymous tasks $ task = $ this -> builder -> buildTask ( $ task ) ; if ( $ task -> getSlug ( ) === 'closure' ) { return ; } // Get event name and register listeners $ event = $ this -> getEventHandle ( $ task , $ event ) ; $ event = $ this -> listenTo ( $ event , $ listeners , $ priority ) ; return $ event ; }
Bind a listener to a task.

@param string|array   $task
@param string         $event
@param array|callable $listeners
@param int            $priority

@throws \Rocketeer\Services\Builders\TaskCompositionException

@return string|null
Bind a listener to a task .