original_string: private function get_favourites(stdClass $user) : array {
          $ids = [];
  
          if (isloggedin()) {
              $usercontext = \context_user::instance($user->id);
              $ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
              $favourites = $ufservice->find_favourites_by_type('mod_forum', 'discussions');
              foreach ($favourites as $favourite) {
                  $ids[] = $favourite->itemid;
              }
          }
  
          return $ids;
      }
code: private function get_favourites(stdClass $user) : array {
          $ids = [];
  
          if (isloggedin()) {
              $usercontext = \context_user::instance($user->id);
              $ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
              $favourites = $ufservice->find_favourites_by_type('mod_forum', 'discussions');
              foreach ($favourites as $favourite) {
                  $ids[] = $favourite->itemid;
              }
          }
  
          return $ids;
      }
code_tokens: private function get_favourites ( stdClass $ user ) : array { $ ids = [ ] ; if ( isloggedin ( ) ) { $ usercontext = \ context_user :: instance ( $ user -> id ) ; $ ufservice = \ core_favourites \ service_factory :: get_service_for_user_context ( $ usercontext ) ; $ favourites = $ ufservice -> find_favourites_by_type ( 'mod_forum' , 'discussions' ) ; foreach ( $ favourites as $ favourite ) { $ ids [ ] = $ favourite -> itemid ; } } return $ ids ; }
docstring: Get a list of all favourited discussions.
  
  @param stdClass $user The user we are getting favourites for
  @return int[] A list of favourited itemids
docstring_tokens: Get a list of all favourited discussions .