<commit_before>/**
 * @module ol/format/WMSGetFeatureInfo
 */
import {inherits} from '../index.js';
import {extend, includes} from '../array.js';
import GML2 from '../format/GML2.js';
import XMLFeature from '../format/XMLFeature.js';
import {assign} from '../obj.js';
import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';

/**
 * @classdesc
 * Format for reading WMSGetFeatureInfo format. It uses
 * {@link ol.format.GML2} to read features.
 *
 * @constructor
 * @extends {ol.format.XMLFeature}
 * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
 * @api
 */
const WMSGetFeatureInfo = function(opt_options) {

  const options = opt_options ? opt_options : {};

  /**
   * @private
   * @type {string}
   */
  this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver';


  /**
   * @private
   * @type {ol.format.GML2}
   */
  this.gmlFormat_ = new GML2();


  /**
   * @private
   * @type {Array.<string>}
   */
  this.layers_ = options.layers ? options.layers : null;

  XMLFeature.call(this);
};

inherits(WMSGetFeatureInfo, XMLFeature);


/**
 * @const
 * @type {string}
 * @private
 */
WMSGetFeatureInfo.featureIdentifier_ = '_feature';


/**
 * @const
 * @type {string}
 * @private
 */
WMSGetFeatureInfo.layerIdentifier_ = '_layer';


/**
 * @return {Array.<string>} layers
 */
WMSGetFeatureInfo.prototype.getLayers = function() {
  return this.layers_;
};


/**
 * @param {Array.<string>} layers Layers to parse.
 */
WMSGetFeatureInfo.prototype.setLayers = function(layers) {
  this.layers_ = layers;
};


/**
 * @param {Node} node Node.
 * @param {Array.<*>} objectStack Object stack.
 * @return {Array.<ol.Feature>} Features.
 * @private
 */
WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
  node.setAttribute('namespaceURI', this.featureNS_);
  const localName = node.localName;
  /** @type {Array.<ol.Feature>} */
  let features = [];
  if (node.childNodes.length === 0) {
    return features;
  }
  if (localName == 'msGMLOutput') {
    for (let i = 0, ii = node.childNodes.length; i < ii; i++) {
      const layer = node.childNodes[i];
      if (layer.nodeType !== Node.ELEMENT_NODE) {
        continue;
      }
      const context = objectStack[0];

      const toRemove = WMSGetFeatureInfo.layerIdentifier_;
      const layerName = layer.localName.replace(toRemove, '');

      if (this.layers_ && !includes(this.layers_, layerName)) {
        continue;
      }

      const featureType = layerName +
          WMSGetFeatureInfo.featureIdentifier_;
<commit_msg>Remove private static members from WMSGetFeatureInfo format<commit_after>/**
 * @module ol/format/WMSGetFeatureInfo
 */
import {inherits} from '../index.js';
import {extend, includes} from '../array.js';
import GML2 from '../format/GML2.js';
import XMLFeature from '../format/XMLFeature.js';
import {assign} from '../obj.js';
import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';

/**
 * @classdesc
 * Format for reading WMSGetFeatureInfo format. It uses
 * {@link ol.format.GML2} to read features.
 *
 * @constructor
 * @extends {ol.format.XMLFeature}
 * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
 * @api
 */
const WMSGetFeatureInfo = function(opt_options) {

  const options = opt_options ? opt_options : {};

  /**
   * @private
   * @type {string}
   */
  this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver';


  /**
   * @private
   * @type {ol.format.GML2}
   */
  this.gmlFormat_ = new GML2();


  /**
   * @private
   * @type {Array.<string>}
   */
  this.layers_ = options.layers ? options.layers : null;

  XMLFeature.call(this);
};

inherits(WMSGetFeatureInfo, XMLFeature);


/**
 * @const
 * @type {string}
 */
const featureIdentifier = '_feature';


/**
 * @const
 * @type {string}
 */
const layerIdentifier = '_layer';


/**
 * @return {Array.<string>} layers
 */
WMSGetFeatureInfo.prototype.getLayers = function() {
  return this.layers_;
};


/**
 * @param {Array.<string>} layers Layers to parse.
 */
WMSGetFeatureInfo.prototype.setLayers = function(layers) {
  this.layers_ = layers;
};


/**
 * @param {Node} node Node.
 * @param {Array.<*>} objectStack Object stack.
 * @return {Array.<ol.Feature>} Features.
 * @private
 */
WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
  node.setAttribute('namespaceURI', this.featureNS_);
  const localName = node.localName;
  /** @type {Array.<ol.Feature>} */
  let features = [];
  if (node.childNodes.length === 0) {
    return features;
  }
  if (localName == 'msGMLOutput') {
    for (let i = 0, ii = node.childNodes.length; i < ii; i++) {
      const layer = node.childNodes[i];
      if (layer.nodeType !== Node.ELEMENT_NODE) {
        continue;
      }
      const context = objectStack[0];

      const toRemove = layerIdentifier;
      const layerName = layer.localName.replace(toRemove, '');

      if (this.layers_ && !includes(this.layers_, layerName)) {
        continue;
      }

      const featureType = layerName +
          featureIdentifier;

{'fraction_non_alphanumeric': 0.16019032513877876, 'fraction_numerical': 0.0031720856463124504, 'mean_word_length': 3.3453919035314383, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7039671', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1646, 'n_words': 356}