JavaScript runkit_method_remove function

A JavaScript equivalent of PHP’s runkit_method_remove
function runkit_method_remove (classname, methodname) {
  // http://kevin.vanzonneveld.net
  // +   original by: Brett Zamir (http://brett-zamir.me)
  // *     example 1: runkit_method_remove('someClass', 'someMethod');
  // *     returns 1: true
  if (typeof classname === 'string') {
    classname = this.window[classname];
  }
  if (getFuncName(classname) !== 'PHP_JS' || // By default, don't allow overriding of PHP functions
  (this.php_js && this.php_js.ini && this.php_js.ini['runkit.internal_override'] && (this.php_js.ini['runkit.internal_override'].local_value === true || this.php_js.ini['runkit.internal_override'].local_value === 1 || this.php_js.ini['runkit.internal_override'].local_value === '1' || this.php_js.ini['runkit.internal_override'].local_value === 'true'))) {
    delete classname.prototype[methodname]; // Delete any on prototype
    return true;
  }
  // delete classname[methodname]; // Delete any as static class method
  return false;
}

Example 1
runkit_method_remove('someClass', 'someMethod');

Should return
true
Теги:
runkit_method_remove
Добавлено: 27 Июля 2018 20:26:45 Добавил: Андрей Ковальчук Нравится 0
Добавить
Комментарии:
Нету комментариев для вывода...