/** * instance getter factory method * * @return TaskListWriter Instance */ public static function getInstance() { if (TaskListWriter::$instance == null) { TaskListWriter::$instance = new TaskListWriter(STDOUT, STDERR); TaskListWriter::$instance->level = Writer::$NORMAL; } return TaskListWriter::$instance; }
/** * */ public function show_tasklist() { $holder = PaskHolder::getInstance(); $tasks = $holder->get_all_tasks(); $descs = array(); foreach ($tasks as $task) { array_push($descs, array('name' => $task['name'], 'desc' => $task['desc'])); } $writer = TaskListWriter::getInstance(); $writer->puts_tasks($descs); }