GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 9-11 lines in 4 locations

app/models/Comment.php 1 location

@@ 154-162 (lines=9) @@
151
      * @return integer number of comments
152
      *
153
      */
154
    public static function countComments($postId){
155
156
        $database = Database::openConnection();
157
        $database->prepare("SELECT COUNT(*) AS count FROM comments WHERE post_id = :post_id");
158
        $database->bindValue(":post_id", $postId);
159
        $database->execute();
160
161
        return (int)$database->fetchAssociative()["count"];
162
    }
163
164
}

app/models/Login.php 2 locations

@@ 195-204 (lines=10) @@
192
     * @param  string   $userIp
193
     * @return bool
194
     */
195
    private function isIpBlocked($userIp){
196
197
        $database = Database::openConnection();
198
        $database->prepare("SELECT ip FROM blocked_ips WHERE ip = :ip LIMIT 1");
199
200
        $database->bindValue(":ip", $userIp);
201
        $database->execute();
202
203
        return $database->countRows() >= 1;
204
    }
205
206
    /**
207
     * Adds a new record(if not exists) to ip_failed_logins table,
@@ 349-359 (lines=11) @@
346
     * @return boolean
347
     *
348
     */
349
    private function isEmailExists($email){
350
351
        // email is already unique in the database,
352
        // So, we can't have more than 2 users with the same emails
353
        $database = Database::openConnection();
354
        $database->prepare("SELECT * FROM users WHERE email = :email AND is_email_activated = 1 LIMIT 1");
355
        $database->bindValue(':email', $email);
356
        $database->execute();
357
358
        return $database->countRows() === 1;
359
    }
360
361
    /**
362
     * Insert or Update(if already exists)

app/core/Session.php 1 location

@@ 344-352 (lines=9) @@
341
     * @return string
342
     *
343
     */
344
    private static function updateSessionId($userId, $sessionId = null){
345
346
        $database = Database::openConnection();
347
        $database->prepare("UPDATE users SET session_id = :session_id WHERE id = :id");
348
349
        $database->bindValue(":session_id", $sessionId);
350
        $database->bindValue(":id", $userId);
351
        $database->execute();
352
    }
353
354
    /**
355
     * Remove the session