original_string: public final function get_config($setting = null) {
          global $DB;
  
          if ($setting) {
              if (!$this->assignment->has_instance()) {
                  return false;
              }
              $assignment = $this->assignment->get_instance();
              if ($assignment) {
                  $dbparams = array('assignment'=>$assignment->id,
                                    'subtype'=>$this->get_subtype(),
                                    'plugin'=>$this->get_type(),
                                    'name'=>$setting);
                  $result = $DB->get_record('assign_plugin_config', $dbparams, '*', IGNORE_MISSING);
                  if ($result) {
                      return $result->value;
                  }
              }
              return false;
          }
          $dbparams = array('assignment'=>$this->assignment->get_instance()->id,
                            'subtype'=>$this->get_subtype(),
                             'plugin'=>$this->get_type());
          $results = $DB->get_records('assign_plugin_config', $dbparams);
  
          $config = new stdClass();
          if (is_array($results)) {
              foreach ($results as $setting) {
                  $name = $setting->name;
                  $config->$name = $setting->value;
              }
          }
          return $config;
      }
code: public final function get_config($setting = null) {
          global $DB;
  
          if ($setting) {
              if (!$this->assignment->has_instance()) {
                  return false;
              }
              $assignment = $this->assignment->get_instance();
              if ($assignment) {
                  $dbparams = array('assignment'=>$assignment->id,
                                    'subtype'=>$this->get_subtype(),
                                    'plugin'=>$this->get_type(),
                                    'name'=>$setting);
                  $result = $DB->get_record('assign_plugin_config', $dbparams, '*', IGNORE_MISSING);
                  if ($result) {
                      return $result->value;
                  }
              }
              return false;
          }
          $dbparams = array('assignment'=>$this->assignment->get_instance()->id,
                            'subtype'=>$this->get_subtype(),
                             'plugin'=>$this->get_type());
          $results = $DB->get_records('assign_plugin_config', $dbparams);
  
          $config = new stdClass();
          if (is_array($results)) {
              foreach ($results as $setting) {
                  $name = $setting->name;
                  $config->$name = $setting->value;
              }
          }
          return $config;
      }
code_tokens: public final function get_config ( $ setting = null ) { global $ DB ; if ( $ setting ) { if ( ! $ this -> assignment -> has_instance ( ) ) { return false ; } $ assignment = $ this -> assignment -> get_instance ( ) ; if ( $ assignment ) { $ dbparams = array ( 'assignment' => $ assignment -> id , 'subtype' => $ this -> get_subtype ( ) , 'plugin' => $ this -> get_type ( ) , 'name' => $ setting ) ; $ result = $ DB -> get_record ( 'assign_plugin_config' , $ dbparams , '*' , IGNORE_MISSING ) ; if ( $ result ) { return $ result -> value ; } } return false ; } $ dbparams = array ( 'assignment' => $ this -> assignment -> get_instance ( ) -> id , 'subtype' => $ this -> get_subtype ( ) , 'plugin' => $ this -> get_type ( ) ) ; $ results = $ DB -> get_records ( 'assign_plugin_config' , $ dbparams ) ; $ config = new stdClass ( ) ; if ( is_array ( $ results ) ) { foreach ( $ results as $ setting ) { $ name = $ setting -> name ; $ config -> $ name = $ setting -> value ; } } return $ config ; }
docstring: Get a configuration value for this plugin
  
  @param mixed $setting The config key (string) or null
  @return mixed string | false
docstring_tokens: Get a configuration value for this plugin