modified:   README.md
	modified:   src/Task.php
	modified:   tests/TaskManagerTest.php
This commit is contained in:
DavidBadura
2015-02-06 17:40:08 +00:00
parent a58ceedefc
commit 9ef7c833f0
3 changed files with 14 additions and 2 deletions

View File

@@ -184,6 +184,10 @@ class Task
*/
public function addTag($tag)
{
if (!$this->tags) {
$this->tags = [$tag];
}
if (!in_array($tag, $this->tags)) {
$this->tags[] = $tag;
}
@@ -194,6 +198,10 @@ class Task
*/
public function removeTag($tag)
{
if (!$this->tags) {
return;
}
if (false !== $key = array_search($tag, $this->tags)) {
unset($this->tags[$key]);
}