src/Rocketeer/Services/Tasks/TasksHandler.php
public function listenTo($event, $listeners, $priority = 0)
    {
        /** @var \Rocketeer\Tasks\AbstractTask[] $listeners */
        $listeners = $this->builder->isCallable($listeners) ? [$listeners] : (array) $listeners;
        $listeners = $this->builder->buildTasks($listeners);
        $event = Str::contains($event, ['commands.', 'strategies.', 'tasks.']) ? $event : 'tasks.'.$event;

        // Register events
        foreach ($listeners as $key => $listener) {
            $handle = $this->getEventHandle(null, $event);
            $this->events->addListener($handle, $listener, $priority ?: -$key);
        }

        return $event;
    }
public function listenTo($event, $listeners, $priority = 0)
    {
        /** @var \Rocketeer\Tasks\AbstractTask[] $listeners */
        $listeners = $this->builder->isCallable($listeners) ? [$listeners] : (array) $listeners;
        $listeners = $this->builder->buildTasks($listeners);
        $event = Str::contains($event, ['commands.', 'strategies.', 'tasks.']) ? $event : 'tasks.'.$event;

        // Register events
        foreach ($listeners as $key => $listener) {
            $handle = $this->getEventHandle(null, $event);
            $this->events->addListener($handle, $listener, $priority ?: -$key);
        }

        return $event;
    }
public function listenTo ( $ event , $ listeners , $ priority = 0 ) { /** @var \Rocketeer\Tasks\AbstractTask[] $listeners */ $ listeners = $ this -> builder -> isCallable ( $ listeners ) ? [ $ listeners ] : ( array ) $ listeners ; $ listeners = $ this -> builder -> buildTasks ( $ listeners ) ; $ event = Str :: contains ( $ event , [ 'commands.' , 'strategies.' , 'tasks.' ] ) ? $ event : 'tasks.' . $ event ; // Register events foreach ( $ listeners as $ key => $ listener ) { $ handle = $ this -> getEventHandle ( null , $ event ) ; $ this -> events -> addListener ( $ handle , $ listener , $ priority ? : - $ key ) ; } return $ event ; }
Register listeners for a particular event.

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

@return string
Register listeners for a particular event .