original_string: public function storeUserIfMissing ($message) {
      $userId = $message['from']['id'];
      $username = strtolower($message['from']['username']);
  
      $query = $this->database->pdo->prepare('SELECT username FROM users WHERE userId = :userId');
      $query->bindParam(':userId', $userId);
      $query->execute();
  
      $user = $query->fetch(PDO::FETCH_ASSOC) ?? false;
  
      // If the user is not registered.
      if (!$user) {
        $query = $this->database->pdo->prepare('INSERT INTO users (userId, username, points) VALUES(:userId, :username, 0)');
        $query->bindParam(':userId', $userId);
        $query->bindParam(':username', $username);
  
        $query->execute();
        return;
      }
  
      // If the username changed.
      if ($username !== $user['username']) {
        $query = $this->database->pdo->prepare('UPDATE users SET username = :username WHERE userId = :userId');
        $query->bindParam(':userId', $userId);
        $query->bindParam(':username', $username);
  
        $query->execute();
      }
    }
code: public function storeUserIfMissing ($message) {
      $userId = $message['from']['id'];
      $username = strtolower($message['from']['username']);
  
      $query = $this->database->pdo->prepare('SELECT username FROM users WHERE userId = :userId');
      $query->bindParam(':userId', $userId);
      $query->execute();
  
      $user = $query->fetch(PDO::FETCH_ASSOC) ?? false;
  
      // If the user is not registered.
      if (!$user) {
        $query = $this->database->pdo->prepare('INSERT INTO users (userId, username, points) VALUES(:userId, :username, 0)');
        $query->bindParam(':userId', $userId);
        $query->bindParam(':username', $username);
  
        $query->execute();
        return;
      }
  
      // If the username changed.
      if ($username !== $user['username']) {
        $query = $this->database->pdo->prepare('UPDATE users SET username = :username WHERE userId = :userId');
        $query->bindParam(':userId', $userId);
        $query->bindParam(':username', $username);
  
        $query->execute();
      }
    }
code_tokens: public function storeUserIfMissing ( $ message ) { $ userId = $ message [ 'from' ] [ 'id' ] ; $ username = strtolower ( $ message [ 'from' ] [ 'username' ] ) ; $ query = $ this -> database -> pdo -> prepare ( 'SELECT username FROM users WHERE userId = :userId' ) ; $ query -> bindParam ( ':userId' , $ userId ) ; $ query -> execute ( ) ; $ user = $ query -> fetch ( PDO :: FETCH_ASSOC ) ?? false ; // If the user is not registered. if ( ! $ user ) { $ query = $ this -> database -> pdo -> prepare ( 'INSERT INTO users (userId, username, points) VALUES(:userId, :username, 0)' ) ; $ query -> bindParam ( ':userId' , $ userId ) ; $ query -> bindParam ( ':username' , $ username ) ; $ query -> execute ( ) ; return ; } // If the username changed. if ( $ username !== $ user [ 'username' ] ) { $ query = $ this -> database -> pdo -> prepare ( 'UPDATE users SET username = :username WHERE userId = :userId' ) ; $ query -> bindParam ( ':userId' , $ userId ) ; $ query -> bindParam ( ':username' , $ username ) ; $ query -> execute ( ) ; } }
docstring: Checks if the user is already registered.
  If yes, checks if her username is changed and update it.
  Otherwise, register the new user.
  
  @param $db The reference to the PDO object.
  @param $message The incoming message.
  
  @return void
docstring_tokens: Checks if the user is already registered . If yes checks if her username is changed and update it . Otherwise register the new user .