original_string: public static function get_type_by_typename($typename) {
          global $DB;
          $cache = cache::make('core', 'repositories');
          if (($repositorytype = $cache->get('typename:'. $typename)) === false) {
              $repositorytype = null;
              if ($record = $DB->get_record('repository', array('type' => $typename))) {
                  $repositorytype = new repository_type($record->type, (array)get_config($record->type), $record->visible, $record->sortorder);
                  $cache->set('typeid:'. $record->id, $repositorytype);
              }
              $cache->set('typename:'. $typename, $repositorytype);
          }
          return $repositorytype;
      }
code: public static function get_type_by_typename($typename) {
          global $DB;
          $cache = cache::make('core', 'repositories');
          if (($repositorytype = $cache->get('typename:'. $typename)) === false) {
              $repositorytype = null;
              if ($record = $DB->get_record('repository', array('type' => $typename))) {
                  $repositorytype = new repository_type($record->type, (array)get_config($record->type), $record->visible, $record->sortorder);
                  $cache->set('typeid:'. $record->id, $repositorytype);
              }
              $cache->set('typename:'. $typename, $repositorytype);
          }
          return $repositorytype;
      }
code_tokens: public static function get_type_by_typename ( $ typename ) { global $ DB ; $ cache = cache :: make ( 'core' , 'repositories' ) ; if ( ( $ repositorytype = $ cache -> get ( 'typename:' . $ typename ) ) === false ) { $ repositorytype = null ; if ( $ record = $ DB -> get_record ( 'repository' , array ( 'type' => $ typename ) ) ) { $ repositorytype = new repository_type ( $ record -> type , ( array ) get_config ( $ record -> type ) , $ record -> visible , $ record -> sortorder ) ; $ cache -> set ( 'typeid:' . $ record -> id , $ repositorytype ) ; } $ cache -> set ( 'typename:' . $ typename , $ repositorytype ) ; } return $ repositorytype ; }
docstring: Get a repository type object by a given type name.
  
  @static
  @param string $typename the repository type name
  @return repository_type|bool
docstring_tokens: Get a repository type object by a given type name .