original_string: public function find_favourite(int $userid, string $component, string $itemtype, int $itemid, int $contextid) : favourite {
          global $DB;
          // Favourites model: We know that only one favourite can exist based on these properties.
          $record = $DB->get_record($this->favouritetable, [
              'userid' => $userid,
              'component' => $component,
              'itemtype' => $itemtype,
              'itemid' => $itemid,
              'contextid' => $contextid
          ], '*', MUST_EXIST);
          return $this->get_favourite_from_record($record);
      }
code: public function find_favourite(int $userid, string $component, string $itemtype, int $itemid, int $contextid) : favourite {
          global $DB;
          // Favourites model: We know that only one favourite can exist based on these properties.
          $record = $DB->get_record($this->favouritetable, [
              'userid' => $userid,
              'component' => $component,
              'itemtype' => $itemtype,
              'itemid' => $itemid,
              'contextid' => $contextid
          ], '*', MUST_EXIST);
          return $this->get_favourite_from_record($record);
      }
code_tokens: public function find_favourite ( int $ userid , string $ component , string $ itemtype , int $ itemid , int $ contextid ) : favourite { global $ DB ; // Favourites model: We know that only one favourite can exist based on these properties. $ record = $ DB -> get_record ( $ this -> favouritetable , [ 'userid' => $ userid , 'component' => $ component , 'itemtype' => $ itemtype , 'itemid' => $ itemid , 'contextid' => $ contextid ] , '*' , MUST_EXIST ) ; return $ this -> get_favourite_from_record ( $ record ) ; }
docstring: Find a specific favourite, based on the properties known to identify it.
  
  Used if we don't know its id.
  
  @param int $userid the id of the user to which the favourite belongs.
  @param string $component the frankenstyle component name.
  @param string $itemtype the type of the favourited item.
  @param int $itemid the id of the item which was favourited (not the favourite's id).
  @param int $contextid the contextid of the item which was favourited.
  @return favourite the favourite.
  @throws \dml_exception if any database errors are encountered or if the record could not be found.
docstring_tokens: Find a specific favourite based on the properties known to identify it .