original_string: public static function create($data) {
          global $DB;
          $data = (object)$data;
          $tagcolls = self::get_collections();
          $tagcoll = (object)array(
              'name' => $data->name,
              'isdefault' => 0,
              'component' => !empty($data->component) ? $data->component : null,
              'sortorder' => count($tagcolls),
              'searchable' => isset($data->searchable) ? (int)(bool)$data->searchable : 1,
              'customurl' => !empty($data->customurl) ? $data->customurl : null,
          );
          $tagcoll->id = $DB->insert_record('tag_coll', $tagcoll);
  
          // Reset cache.
          cache::make('core', 'tags')->delete('tag_coll');
  
          \core\event\tag_collection_created::create_from_record($tagcoll)->trigger();
          return $tagcoll;
      }
code: public static function create($data) {
          global $DB;
          $data = (object)$data;
          $tagcolls = self::get_collections();
          $tagcoll = (object)array(
              'name' => $data->name,
              'isdefault' => 0,
              'component' => !empty($data->component) ? $data->component : null,
              'sortorder' => count($tagcolls),
              'searchable' => isset($data->searchable) ? (int)(bool)$data->searchable : 1,
              'customurl' => !empty($data->customurl) ? $data->customurl : null,
          );
          $tagcoll->id = $DB->insert_record('tag_coll', $tagcoll);
  
          // Reset cache.
          cache::make('core', 'tags')->delete('tag_coll');
  
          \core\event\tag_collection_created::create_from_record($tagcoll)->trigger();
          return $tagcoll;
      }
code_tokens: public static function create ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ tagcolls = self :: get_collections ( ) ; $ tagcoll = ( object ) array ( 'name' => $ data -> name , 'isdefault' => 0 , 'component' => ! empty ( $ data -> component ) ? $ data -> component : null , 'sortorder' => count ( $ tagcolls ) , 'searchable' => isset ( $ data -> searchable ) ? ( int ) ( bool ) $ data -> searchable : 1 , 'customurl' => ! empty ( $ data -> customurl ) ? $ data -> customurl : null , ) ; $ tagcoll -> id = $ DB -> insert_record ( 'tag_coll' , $ tagcoll ) ; // Reset cache. cache :: make ( 'core' , 'tags' ) -> delete ( 'tag_coll' ) ; \ core \ event \ tag_collection_created :: create_from_record ( $ tagcoll ) -> trigger ( ) ; return $ tagcoll ; }
docstring: Creates a new tag collection
  
  @param stdClass $data data from form core_tag_collection_form
  @return int|false id of created tag collection or false if failed
docstring_tokens: Creates a new tag collection