/** * Save the resource IFF it has changed. * @see \Todoist\Todoist::getApiSingleCommandResponse * @return \Todoist\Resource\Resource */ public function &save() { $source = json_encode($this->source); $data = json_encode($this->data); if ($source === $data) { return $this; } // Attempt to perform the simple update. // This throws an exception if it would return anything other than TRUE. $this->engine->getApiSingleCommandResponse($this->update_method, $this->data); return $this; }