Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php  | 
            ||
| 31 | class NextNoteService { | 
            ||
| 32 | |||
| 33 | private $noteMapper;  | 
            ||
| 34 | private $utils;  | 
            ||
| 35 | |||
| 36 | 	public function __construct(NextNoteMapper $noteMapper, Utils $utils) { | 
            ||
| 40 | |||
| 41 | /**  | 
            ||
| 42 | * Get vaults from a user.  | 
            ||
| 43 | *  | 
            ||
| 44 | * @param $userId  | 
            ||
| 45 | * @param int|bool $deleted  | 
            ||
| 46 | * @param string|bool $grouping  | 
            ||
| 47 | * @return NextNote[]  | 
            ||
| 48 | */  | 
            ||
| 49 | 	public function findNotesFromUser($userId, $deleted = false, $grouping = false) { | 
            ||
| 53 | |||
| 54 | /**  | 
            ||
| 55 | * Get a single vault  | 
            ||
| 56 | *  | 
            ||
| 57 | * @param $note_id  | 
            ||
| 58 | * @param $user_id  | 
            ||
| 59 | * @param bool|int $deleted  | 
            ||
| 60 | * @return NextNote  | 
            ||
| 61 | * @internal param $vault_id  | 
            ||
| 62 | */  | 
            ||
| 63 | 	public function find($note_id, $user_id = null, $deleted = false) { | 
            ||
| 67 | |||
| 68 | /**  | 
            ||
| 69 | * Creates a note  | 
            ||
| 70 | *  | 
            ||
| 71 | * @param array|NextNote $note  | 
            ||
| 72 | * @param $userId  | 
            ||
| 73 | * @return NextNote  | 
            ||
| 74 | * @throws \Exception  | 
            ||
| 75 | */  | 
            ||
| 76 | View Code Duplication | 	public function create($note, $userId) { | 
            |
| 91 | |||
| 92 | /**  | 
            ||
| 93 | * Update vault  | 
            ||
| 94 | *  | 
            ||
| 95 | * @param $note array|NextNote  | 
            ||
| 96 | * @return NextNote|bool  | 
            ||
| 97 | * @throws \Exception  | 
            ||
| 98 | * @internal param $userId  | 
            ||
| 99 | * @internal param $vault  | 
            ||
| 100 | */  | 
            ||
| 101 | View Code Duplication | 	public function update($note) { | 
            |
| 123 | |||
| 124 | 	public function renameNote($FOLDER, $id, $in_newname, $in_newgroup, $uid = null) { | 
            ||
| 135 | |||
| 136 | /**  | 
            ||
| 137 | * Delete a vault from user  | 
            ||
| 138 | *  | 
            ||
| 139 | * @param $note_id  | 
            ||
| 140 | * @param string $user_id  | 
            ||
| 141 | * @return bool  | 
            ||
| 142 | * @internal param string $vault_guid  | 
            ||
| 143 | */  | 
            ||
| 144 | 	public function delete($note_id, $user_id = null) { | 
            ||
| 157 | |||
| 158 | |||
| 159 | /**  | 
            ||
| 160 | * @param $FOLDER  | 
            ||
| 161 | * @param boolean $showdel  | 
            ||
| 162 | * @return array  | 
            ||
| 163 | * @throws \Exception  | 
            ||
| 164 | */  | 
            ||
| 165 | 	public function getListing($FOLDER, $showdel) { | 
            ||
| 168 | |||
| 169 | 	private function checkPermissions($permission, $nid) { | 
            ||
| 182 | }  | 
            ||
| 183 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.