Code Duplication    Length = 8-8 lines in 2 locations

controller/noteapicontroller.php 2 locations

@@ 160-167 (lines=8) @@
157
		}
158
159
160
		if(!empty($notebook_id)){
161
			$notebook = $this->notebookService->find($notebook_id);
162
			if($notebook instanceof Notebook) {
163
				$note->setNotebook($notebook->getId());
164
			} else {
165
				return new JSONResponse(['error' => 'Notebook not found']);
166
			}
167
		}
168
		$note->setName($title);
169
		$note->setNote($content);
170
		$note->setDeleted($deleted);
@@ 127-134 (lines=8) @@
124
		$note->setMtime(time());
125
		$note->setDeleted(0);
126
127
		if(!empty($notebook_id)){
128
			$notebook = $this->notebookService->find($notebook_id);
129
			if($notebook instanceof Notebook) {
130
				$note->setNotebook($notebook->getId());
131
			} else {
132
				return new JSONResponse(['error' => 'Notebook not found']);
133
			}
134
		}
135
136
		$result = $this->noteService->create($note)->jsonSerialize();
137
		\OC_Hook::emit('OCA\NextNote', 'post_create_note', ['note' => $note]);