/** * @param string $taskrc * @param string $taskData * @param array $rcOptions * @param string $bin * @throws TaskwarriorException */ public function __construct($taskrc = '~/.taskrc', $taskData = '~/.task', $rcOptions = [], $bin = 'task') { $this->bin = Path::canonicalize($bin); $this->taskrc = Path::canonicalize($taskrc); $this->taskData = Path::canonicalize($taskData); $this->rcOptions = array_merge(array('rc:' . $this->taskrc, 'rc.data.location=' . $this->taskData, 'rc.json.array=true', 'rc.json.depends.array=true', 'rc.confirmation=no'), $rcOptions); if (version_compare($this->version(), '2.5.0') < 0) { throw new TaskwarriorException(sprintf("Taskwarrior version %s isn't supported", $this->version())); } try { Assert::readable($this->taskrc); Assert::readable($this->taskData); Assert::writable($this->taskData); } catch (\InvalidArgumentException $e) { throw new TaskwarriorException($e->getMessage(), $e->getCode(), $e); } }