/* ======= /* Methods /* =======
424676
function clear() {
    /* clear browser console */
    if (shouldLogToConsole && console && console.clear) {
      console.clear();
    }
    /* clear app console */
    if (shouldLogToElement) {
      element.value = '';
      element.scrollTop = element.scrollHeight;
    }
  }
114459
function provideAppMethods(model, methodsProto) {
  /*jshint immed:false */
  var key, method,
      cname = inflect.camelize(model.context),
      scname = inflect.singularize(cname),
      Application = app.constructor;
      
  var pluralize = /^(get|find|delete|destroy)$/
      
  for (key in methodsProto) {
    var suffix = (key.slice(-3) === 'All') ? cname : scname;
    method = key + suffix;
    (function(model, key, method) {
      app.model[method] = function() {
        model[key].apply(model, arguments);
      }
      if (pluralize.test(key)) {
        app.model[key + inflect.pluralize(suffix)] = app.model[method];
      }
    }).call(this, model, key, method);
  }
}
1349311
function wrapmethods(sess) {
      var _reload = sess.reload
      var _save = sess.save;

      function reload(callback) {
        debug('reloading %s', this.id)
        _reload.call(this, function () {
          wrapmethods(req.session)
          callback.apply(this, arguments)
        })
      }

      function save() {
        debug('saving %s', this.id);
        savedHash = hash(this);
        _save.apply(this, arguments);
      }

      Object.defineProperty(sess, 'reload', {
        configurable: true,
        enumerable: false,
        value: reload,
        writable: true
      })

      Object.defineProperty(sess, 'save', {
        configurable: true,
        enumerable: false,
        value: save,
        writable: true
      });
    }
277058
function checkMethod(expected, actual){
    if(!expected || !actual){
        return;
    }
    if(actual.toLowerCase() !== expected.toLowerCase()){
        return {
            error: "HTTP Methods are not equal",
            actual: actual,
            expected: expected,
            showDiff: true
        };
    }
}
1103967
void createMethodBody(String classname, ExecutableElement methodElement, List<String> arguments, Writer writer) throws IOException {
		String methodName = getMethodName(methodElement);
		boolean ws = isWebsocketDataService(methodElement);
		String args = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator());
		String keys = computeKeys(methodElement, arguments);
		createReturnOcelotPromiseFactory(classname, methodName, ws, args, keys, writer);
	}
344982
function enrichMethodNode(methodNode, method) {
  method.description && (methodNode.description = method.description)

  if (method.tags.route) {
    let httpPath = method.tags.route
    let httpMethod = 'GET'
    const sepPos = httpPath.indexOf(' ')

    if (sepPos !== -1) {
      httpMethod = httpPath.substr(0, sepPos).toUpperCase()
      httpPath = httpPath.substr(sepPos + 1)

      if (!isValidHttpMethod(httpMethod)) {
        throw new Error(`Unsupported HTTP method [${httpMethod}] for ${method.name} method`)
      }
    }

    methodNode.method = httpMethod
    methodNode.path = httpPath
  }

  return methodNode
}
883546
function(data, method) {

	var urlencodedForm = true;
	
	if (typeof data == 'string') {
		this.ioData = data;
	} else if (typeof data == 'object' && data._node) {

		if (data.getAttribute('enctype')) {
			urlencodedForm = false;
		}
		
		this.ioData = new FormData(data._node);
	}

	var req = this.req,
		method = method || 'POST';

	req.open(method, this.url);

	//Send the proper header information along with the request
	// Send as form encoded if we do not have a file field
	if (urlencodedForm) {
		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	}

	return this._run();
}
339238
function validMethod(req, res, next) {
    if (httpMethods.indexOf(req.method) === -1) {
        res.sendStatus(405);
    } else {
        next();
    }
}
981900
function methodize(fn) {
    return function() {
      var args = [this];
      args.push.apply(args, arguments);
      return fn.apply(null, args);
    };
  }
1374568
function(method, url, headers, data, callback) {

		var r = new XMLHttpRequest();
		var error = this.error;

		// Binary?
		var binary = false;
		if (method === 'blob') {
			binary = method;
			method = 'GET';
		}

		method = method.toUpperCase();

		// Xhr.responseType 'json' is not supported in any of the vendors yet.
		r.onload = function(e) {
			var json = r.response;
			try {
				json = JSON.parse(r.responseText);
			}
			catch (_e) {
				if (r.status === 401) {
					json = error('access_denied', r.statusText);
				}
			}

			var headers = headersToJSON(r.getAllResponseHeaders());
			headers.statusCode = r.status;

			callback(json || (method === 'GET' ? error('empty_response', 'Could not get resource') : {}), headers);
		};

		r.onerror = function(e) {
			var json = r.responseText;
			try {
				json = JSON.parse(r.responseText);
			}
			catch (_e) {}

			callback(json || error('access_denied', 'Could not get resource'));
		};

		var x;

		// Should we add the query to the URL?
		if (method === 'GET' || method === 'DELETE') {
			data = null;
		}
		else if (data && typeof (data) !== 'string' && !(data instanceof FormData) && !(data instanceof File) && !(data instanceof Blob)) {
			// Loop through and add formData
			var f = new FormData();
			for (x in data) if (data.hasOwnProperty(x)) {
				if (data[x] instanceof HTMLInputElement) {
					if ('files' in data[x] && data[x].files.length > 0) {
						f.append(x, data[x].files[0]);
					}
				}
				else if (data[x] instanceof Blob) {
					f.append(x, data[x], data.name);
				}
				else {
					f.append(x, data[x]);
				}
			}

			data = f;
		}

		// Open the path, async
		r.open(method, url, true);

		if (binary) {
			if ('responseType' in r) {
				r.responseType = binary;
			}
			else {
				r.overrideMimeType('text/plain; charset=x-user-defined');
			}
		}

		// Set any bespoke headers
		if (headers) {
			for (x in headers) {
				r.setRequestHeader(x, headers[x]);
			}
		}

		r.send(data);

		return r;

		// Headers are returned as a string
		function headersToJSON(s) {
			var r = {};
			var reg = /([a-z\-]+):\s?(.*);?/gi;
			var m;
			while ((m = reg.exec(s))) {
				r[m[1]] = m[2];
			}

			return r;
		}
	}
244383
@Override
    public void setMethod(MethodValues method) {
        this.myMethod = method;
        super.setFirstLineChanged();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "setMethod(v): " + (null != method ? method.getName() : null));
        }
    }
801170
function() {
            var newMethods = $._.$.iot.extraCAMethods();
            $._.$.log && $._.$.log.debug('Adding CA methods:' +
                                         JSON.stringify(Object
                                                        .keys(newMethods)));
            myUtils.mixin($.handler, newMethods, true);
        }
548637
private void addArrayMethods(List<MethodNode> methods, ClassNode receiver, String name, ClassNode[] args) {
        if (args.length!=1) return;
        if (!receiver.isArray()) return;
        if (!isIntCategory(getUnwrapper(args[0]))) return;
        if ("getAt".equals(name)) {
            MethodNode node = new MethodNode(name, Opcodes.ACC_PUBLIC, receiver.getComponentType(), new Parameter[]{new Parameter(args[0],"arg")}, null, null);
            node.setDeclaringClass(receiver.redirect());
            methods.add(node);
        } else if ("setAt".equals(name)) {
            MethodNode node = new MethodNode(name, Opcodes.ACC_PUBLIC, VOID_TYPE, new Parameter[]{new Parameter(args[0],"arg")}, null, null);
            node.setDeclaringClass(receiver.redirect());
            methods.add(node);
        }
    }
336619
function getCurrentNodeMethods () {
  return http.METHODS && http.METHODS.map(function upperCaseMethod (method) {
    return method.toUpperCase()
  })
}
1172019
function onceConnected( error, methods ) {

  if( !error ) {
    console.log( 'Connected to %s. There are %d methods available.', this.get( 'url' ), this.get( 'methods' ).length );
  }

  //console.log( require( 'util' ).inspect( this.get( 'methods' ), {showHidden: false, depth: 2, colors: true} ) );

  this.methodCall('wpp.systemCheck', [ 1, process.env.WORDPRESS_USERNAME, process.env.WORDPRESS_PASSWORD ], function( error, data ) {
    console.log( 'error', require( 'util' ).inspect( error, {showHidden: false, depth: 2, colors: true} ) );
    console.log( 'data', require( 'util' ).inspect( data, {showHidden: false, depth: 2, colors: true} ) );
  });

  if( error ) {
    console.error( error.message );
  }

}
954885
function(method, sId) {
            sId = sId || method;
            sId = this.options.prefix+"."+sId;
            return this.addMethod(method, {
                fallback: function(args, options, method) {
                    return Storage.get(sId+"."+method);
                },
                after: function(args, results, options, method) {
                    Storage.set(sId+"."+method, results);
                }
            });
        }
832408
function APIRequest(method, url) {
	var data, callback, opts, req, headers = messageHeaders(this);
	callback = ( typeof(arguments[2]) === 'function' ? arguments[2] : (data = arguments[2], arguments[3]) );

	if (isNode) {
		opts = URL.parse(url);
		opts.method = method;
		opts.headers = headers;

		req = requesters[opts.protocol.slice(0, -1)].request(opts, function(res) {
			var chunks = [];
			res.on('data', function(c) { chunks[chunks.length] = c; });
			res.once('end', function() {
				chunks = Buffer.concat(chunks);
				Zlib.gunzip(chunks, function(err, uc) {
					if (!err) uc = uc.toString();
					try { res.body = JSON.parse(uc || chunks); } catch(e) {}
					return callback(null, res);
				});
			});
		});
		if (type(data) === 'object' || method.toLowerCase() === 'get') req.setHeader("Content-Type", "application/json; charset=utf-8");
		if (data instanceof Multipart) req.setHeader("Content-Type", "multipart/form-data; boundary=" + data.boundary);
		if (data) req.write( data.result || JSON.stringify(data), data.result ? 'binary' : 'utf-8' );
		req.end();

		return req.once('error', function(e) { return callback(e.message); });
	}

	req = new XMLHttpRequest();
	req.open(method.toUpperCase(), url, true);
	for (var key in headers) {
		req.setRequestHeader(key, headers[key]);
	}
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			req.statusCode = req.status;
			req.statusMessage = req.statusText;
			try {req.body = JSON.parse(req.responseText);} catch (e) { return handleErrCB(e, callback); }
			callback(null, req);
		}
	};
	if (type(data) === 'object' || method.toLowerCase() === 'get') req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
	if (data instanceof Multipart) req.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + data.boundary);
	if (data) return req.send( data.result ? data.result : JSON.stringify(data) );
	req.send(null);
}