Code Duplication    Length = 8-8 lines in 2 locations

controller/noteapicontroller.php 2 locations

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