Code Duplication    Length = 11-11 lines in 3 locations

src/Repository/NoteRepository.php 1 location

@@ 67-77 (lines=11) @@
64
        return $this->checkAndGetNote((int) $this->database->lastInsertId());
65
    }
66
67
    public function updateNote($note)
68
    {
69
        $query = 'UPDATE `notes` SET `name` = :name, `description` = :description WHERE `id` = :id';
70
        $statement = $this->database->prepare($query);
71
        $statement->bindParam(':id', $note->id);
72
        $statement->bindParam(':name', $note->name);
73
        $statement->bindParam(':description', $note->description);
74
        $statement->execute();
75
76
        return $this->checkAndGetNote((int) $note->id);
77
    }
78
79
    public function deleteNote(int $noteId)
80
    {

src/Repository/UserRepository.php 2 locations

@@ 81-91 (lines=11) @@
78
        return $user;
79
    }
80
81
    public function create($user)
82
    {
83
        $query = 'INSERT INTO `users` (`name`, `email`, `password`) VALUES (:name, :email, :password)';
84
        $statement = $this->database->prepare($query);
85
        $statement->bindParam('name', $user->name);
86
        $statement->bindParam('email', $user->email);
87
        $statement->bindParam('password', $user->password);
88
        $statement->execute();
89
90
        return $this->getUser((int) $this->database->lastInsertId());
91
    }
92
93
    public function update($user)
94
    {
@@ 93-103 (lines=11) @@
90
        return $this->getUser((int) $this->database->lastInsertId());
91
    }
92
93
    public function update($user)
94
    {
95
        $query = 'UPDATE `users` SET `name` = :name, `email` = :email WHERE `id` = :id';
96
        $statement = $this->database->prepare($query);
97
        $statement->bindParam('id', $user->id);
98
        $statement->bindParam('name', $user->name);
99
        $statement->bindParam('email', $user->email);
100
        $statement->execute();
101
102
        return $this->getUser((int) $user->id);
103
    }
104
105
    public function delete(int $userId): string
106
    {