diff --git a/src/Annotation.php b/src/Annotation.php new file mode 100644 index 0000000..c656dd7 --- /dev/null +++ b/src/Annotation.php @@ -0,0 +1,50 @@ + + */ +class Annotation +{ + /** + * @var string + * + * @JMS\Type("string") + */ + private $description; + + /** + * @var Carbon + * + * @JMS\Type("Carbon") + */ + private $entry; + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * @return Carbon + */ + public function getEntry() + { + return $this->entry; + } +} \ No newline at end of file diff --git a/src/Task.php b/src/Task.php index 220e012..3c33928 100644 --- a/src/Task.php +++ b/src/Task.php @@ -106,6 +106,13 @@ class Task */ private $until; + /** + * @var Annotation[] + * + * @JMS\Type("array") + */ + private $annotations; + /** * @var Carbon * @@ -352,6 +359,46 @@ class Task $this->until = $this->parseDateTime($until); } + /** + * @return Annotation[] + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * @param Annotation[] $annotations + */ + public function setAnnotations(array $annotations = []) + { + $this->annotations = []; + + foreach ($annotations as $annotation) { + $this->addAnnotation($annotation); + } + } + + /** + * @param Annotation $annotation + */ + public function addAnnotation(Annotation $annotation) + { + if (!in_array($annotation, $this->annotations)) { + $this->annotations[] = $annotation; + } + } + + /** + * @param Annotation $annotation + */ + public function removeAnnotation(Annotation $annotation) + { + if ($key = array_search($annotation, $this->annotations)) { + unset($this->annotations[$key]); + } + } + /** * @return Carbon */