taskConfig = $taskConfig; } else { $this->taskConfig = new Config(); } $this->taskwarrior = $this->taskConfig->getTaskwarriorInstance(); $this->logger = $this->taskConfig->getLogger(); } public function importTask(VTodo $ToDoComponent = null){ if(!isset($ToDoComponent)){ $this->logger->error("vCal ToDo component is not defined"); throw new Exception("vCal Todo component is not defined"); } if($this->taskwarrior->exists($ToDoComponent->UID)){ $this->logger->error("Event already exists " . (string)$ToDoComponent->UID); throw new Exception\BadRequest("Event already exists " . $ToDoComponent->UID); } try { $this->taskwarrior->setUUID($ToDoComponent->UID); $this->taskwarrior->setEntryTime($ToDoComponent->DSTAMP); $this->taskwarrior->setDueDate($ToDoComponent->DUE); $this->taskwarrior->setModifiedTime($ToDoComponent->{'LAST-MODIFIED'}); $this->taskwarrior->setStartTime($ToDoComponent->DSTART); $this->taskwarrior->setEndTime($ToDoComponent->DTEND); $this->taskwarrior->setSummary($ToDoComponent->DESCRIPTION); $this->taskwarrior->setCategories($ToDoComponent->CATEGORIES); $this->taskwarrior->setDescription($ToDoComponent->DESCRIPTION); $this->taskwarrior->build(); $this->taskwarrior->save(); } catch(Exception $e){ $this->logger->error($e->message); throw $e; } } } ?>