Skip to content

Commit

Permalink
Method to determine if a task exists in a task list, and return it.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 19, 2015
1 parent 0247462 commit 66f7a73
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions nag/lib/Task.php
Expand Up @@ -745,6 +745,26 @@ public function reset()
$this->_inlist = false;
}

/**
* Return the task, if present anywhere in this tasklist, regardless of
* child depth.
*
* @param string $taskId The task id we are looking for.
*
* @return Nag_Task|false The task object, if found. Otherwise false.
*/
public function hasTask($taskId)
{
$this->reset();
while ($task = $this->each()) {
if ($task->id == $taskId) {
return $task;
}
}

return false;
}

/**
* Returns the next task iterating through all tasks and sub tasks.
*
Expand Down

0 comments on commit 66f7a73

Please sign in to comment.