original_string: public static function fetch($params) {
          if ($records = self::retrieve_record_set($params)) {
              return reset($records);
          }
  
          $record = grade_object::fetch_helper('grade_categories', 'grade_category', $params);
  
          // We store it as an array to keep a key => result set interface in the cache, grade_object::fetch_helper is
          // managing exceptions. We return only the first element though.
          $records = false;
          if ($record) {
              $records = array($record->id => $record);
          }
  
          self::set_record_set($params, $records);
  
          return $record;
      }
code: public static function fetch($params) {
          if ($records = self::retrieve_record_set($params)) {
              return reset($records);
          }
  
          $record = grade_object::fetch_helper('grade_categories', 'grade_category', $params);
  
          // We store it as an array to keep a key => result set interface in the cache, grade_object::fetch_helper is
          // managing exceptions. We return only the first element though.
          $records = false;
          if ($record) {
              $records = array($record->id => $record);
          }
  
          self::set_record_set($params, $records);
  
          return $record;
      }
code_tokens: public static function fetch ( $ params ) { if ( $ records = self :: retrieve_record_set ( $ params ) ) { return reset ( $ records ) ; } $ record = grade_object :: fetch_helper ( 'grade_categories' , 'grade_category' , $ params ) ; // We store it as an array to keep a key => result set interface in the cache, grade_object::fetch_helper is // managing exceptions. We return only the first element though. $ records = false ; if ( $ record ) { $ records = array ( $ record -> id => $ record ) ; } self :: set_record_set ( $ params , $ records ) ; return $ record ; }
docstring: Finds and returns a grade_category instance based on params.
  
  @param array $params associative arrays varname=>value
  @return grade_category The retrieved grade_category instance or false if none found.
docstring_tokens: Finds and returns a grade_category instance based on params .