Changeset 7778
- Timestamp:
- 03/08/08 14:43:55 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/command/sfCommandApplication.class.php
r7467 r7778 49 49 50 50 $this->configure(); 51 52 $this->registerTasks(); 51 53 } 52 54 … … 81 83 * Registers an array of task objects. 82 84 * 85 * If you pass null, this method will register all available tasks. 86 * 83 87 * @param array An array of tasks 84 88 */ 85 public function registerTasks($tasks) 86 { 89 public function registerTasks($tasks = null) 90 { 91 if (is_null($tasks)) 92 { 93 $tasks = array(); 94 foreach (get_declared_classes() as $class) 95 { 96 $r = new Reflectionclass($class); 97 if ($r->isSubclassOf('sfTask') && !$r->isAbstract()) 98 { 99 $tasks[] = new $class($this->dispatcher, $this->formatter); 100 } 101 } 102 } 103 87 104 foreach ($tasks as $task) 88 105 { branches/1.1/lib/command/sfSymfonyCommandApplication.class.php
r7614 r7778 37 37 $this->setVersion(SYMFONY_VERSION); 38 38 39 $this-> initializeTasks();39 $this->loadTasks(); 40 40 } 41 41 … … 75 75 * Looks for tasks in the symfony core, the current project and all project plugins. 76 76 */ 77 protected function initializeTasks()77 protected function loadTasks() 78 78 { 79 79 $dirs = array( … … 97 97 } 98 98 } 99 100 foreach (get_declared_classes() as $class)101 {102 $r = new Reflectionclass($class);103 if ($r->isSubclassOf('sfTask') && !$r->isAbstract())104 {105 $this->registerTask(new $class($this->dispatcher, $this->formatter));106 }107 }108 99 } 109 100