original_string: public static function get_by_name($tagcollid, $name, $returnfields='id, name, rawname, tagcollid',
                          $strictness = IGNORE_MISSING) {
          global $DB;
          if ($tagcollid == 0) {
              $tags = static::guess_by_name($name, $returnfields);
              if ($tags) {
                  $tag = reset($tags);
                  return $tag;
              } else if ($strictness == MUST_EXIST) {
                  throw new dml_missing_record_exception('tag', 'name=?', array($name));
              }
              return false;
          }
          $name = core_text::strtolower($name);   // To cope with input that might just be wrong case.
          $params = array('name' => $name, 'tagcollid' => $tagcollid);
          $record = $DB->get_record('tag', $params, $returnfields, $strictness);
          if ($record) {
              return new static($record);
          }
          return false;
      }
code: public static function get_by_name($tagcollid, $name, $returnfields='id, name, rawname, tagcollid',
                          $strictness = IGNORE_MISSING) {
          global $DB;
          if ($tagcollid == 0) {
              $tags = static::guess_by_name($name, $returnfields);
              if ($tags) {
                  $tag = reset($tags);
                  return $tag;
              } else if ($strictness == MUST_EXIST) {
                  throw new dml_missing_record_exception('tag', 'name=?', array($name));
              }
              return false;
          }
          $name = core_text::strtolower($name);   // To cope with input that might just be wrong case.
          $params = array('name' => $name, 'tagcollid' => $tagcollid);
          $record = $DB->get_record('tag', $params, $returnfields, $strictness);
          if ($record) {
              return new static($record);
          }
          return false;
      }
code_tokens: public static function get_by_name ( $ tagcollid , $ name , $ returnfields = 'id, name, rawname, tagcollid' , $ strictness = IGNORE_MISSING ) { global $ DB ; if ( $ tagcollid == 0 ) { $ tags = static :: guess_by_name ( $ name , $ returnfields ) ; if ( $ tags ) { $ tag = reset ( $ tags ) ; return $ tag ; } else if ( $ strictness == MUST_EXIST ) { throw new dml_missing_record_exception ( 'tag' , 'name=?' , array ( $ name ) ) ; } return false ; } $ name = core_text :: strtolower ( $ name ) ; // To cope with input that might just be wrong case. $ params = array ( 'name' => $ name , 'tagcollid' => $ tagcollid ) ; $ record = $ DB -> get_record ( 'tag' , $ params , $ returnfields , $ strictness ) ; if ( $ record ) { return new static ( $ record ) ; } return false ; }
docstring: Simple function to just return a single tag object by tagcollid and name
  
  @param int $tagcollid tag collection to use,
  if 0 is given we will try to guess the tag collection and return the first match
  @param string $name tag name
  @param string $returnfields which fields do we want returned. This is a comma separated string
  containing any combination of 'id', 'name', 'rawname', 'tagcollid' or '*' to include all fields.
  @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
  IGNORE_MULTIPLE means return first, ignore multiple records found(not recommended);
  MUST_EXIST means throw exception if no record or multiple records found
  @return core_tag_tag|false tag object
docstring_tokens: Simple function to just return a single tag object by tagcollid and name