original_string: public static function get_defaults($contextlevel, $pluginname = '') {
          $classname = \context_helper::get_class_for_level($contextlevel);
          list($purposevar, $categoryvar) = self::var_names_from_context($classname, $pluginname);
  
          $purposeid = get_config('tool_dataprivacy', $purposevar);
          $categoryid = get_config('tool_dataprivacy', $categoryvar);
  
          if (!empty($pluginname)) {
              list($purposevar, $categoryvar) = self::var_names_from_context($classname);
              // If the plugin-level doesn't have a default purpose set, try the context level.
              if ($purposeid == false) {
                  $purposeid = get_config('tool_dataprivacy', $purposevar);
              }
  
              // If the plugin-level doesn't have a default category set, try the context level.
              if ($categoryid == false) {
                  $categoryid = get_config('tool_dataprivacy', $categoryvar);
              }
          }
  
          if (empty($purposeid)) {
              $purposeid = context_instance::NOTSET;
          }
          if (empty($categoryid)) {
              $categoryid = context_instance::NOTSET;
          }
  
          return [$purposeid, $categoryid];
      }
code: public static function get_defaults($contextlevel, $pluginname = '') {
          $classname = \context_helper::get_class_for_level($contextlevel);
          list($purposevar, $categoryvar) = self::var_names_from_context($classname, $pluginname);
  
          $purposeid = get_config('tool_dataprivacy', $purposevar);
          $categoryid = get_config('tool_dataprivacy', $categoryvar);
  
          if (!empty($pluginname)) {
              list($purposevar, $categoryvar) = self::var_names_from_context($classname);
              // If the plugin-level doesn't have a default purpose set, try the context level.
              if ($purposeid == false) {
                  $purposeid = get_config('tool_dataprivacy', $purposevar);
              }
  
              // If the plugin-level doesn't have a default category set, try the context level.
              if ($categoryid == false) {
                  $categoryid = get_config('tool_dataprivacy', $categoryvar);
              }
          }
  
          if (empty($purposeid)) {
              $purposeid = context_instance::NOTSET;
          }
          if (empty($categoryid)) {
              $categoryid = context_instance::NOTSET;
          }
  
          return [$purposeid, $categoryid];
      }
code_tokens: public static function get_defaults ( $ contextlevel , $ pluginname = '' ) { $ classname = \ context_helper :: get_class_for_level ( $ contextlevel ) ; list ( $ purposevar , $ categoryvar ) = self :: var_names_from_context ( $ classname , $ pluginname ) ; $ purposeid = get_config ( 'tool_dataprivacy' , $ purposevar ) ; $ categoryid = get_config ( 'tool_dataprivacy' , $ categoryvar ) ; if ( ! empty ( $ pluginname ) ) { list ( $ purposevar , $ categoryvar ) = self :: var_names_from_context ( $ classname ) ; // If the plugin-level doesn't have a default purpose set, try the context level. if ( $ purposeid == false ) { $ purposeid = get_config ( 'tool_dataprivacy' , $ purposevar ) ; } // If the plugin-level doesn't have a default category set, try the context level. if ( $ categoryid == false ) { $ categoryid = get_config ( 'tool_dataprivacy' , $ categoryvar ) ; } } if ( empty ( $ purposeid ) ) { $ purposeid = context_instance :: NOTSET ; } if ( empty ( $ categoryid ) ) { $ categoryid = context_instance :: NOTSET ; } return [ $ purposeid , $ categoryid ] ; }
docstring: Returns the default purpose id and category id for the provided context level.
  
  The caller code is responsible of checking that $contextlevel is an integer.
  
  @param int $contextlevel The context level.
  @param string $pluginname The name of the plugin associated with the context level.
  @return int[]|false[]
docstring_tokens: Returns the default purpose id and category id for the provided context level .