コード例 #1
0
 /**
  * Registers a task object.
  *
  * @param sfTask $task An sfTask object
  */
 public function registerTask(sfTask $task)
 {
     if (isset($this->tasks[$task->getFullName()])) {
         throw new sfCommandException(sprintf('The task named "%s" in "%s" task is already registered by the "%s" task.', $task->getFullName(), get_class($task), get_class($this->tasks[$task->getFullName()])));
     }
     $this->tasks[$task->getFullName()] = $task;
     foreach ($task->getAliases() as $alias) {
         if (isset($this->tasks[$alias])) {
             throw new sfCommandException(sprintf('A task named "%s" is already registered.', $alias));
         }
         $this->tasks[$alias] = $task;
     }
 }