当前位置: 首页>>代码示例>>PHP>>正文


PHP Func::setMethods方法代码示例

本文整理汇总了PHP中Func::setMethods方法的典型用法代码示例。如果您正苦于以下问题:PHP Func::setMethods方法的具体用法?PHP Func::setMethods怎么用?PHP Func::setMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Func的用法示例。


在下文中一共展示了Func::setMethods方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Buffer = new Func('Buffer', function () {
         $self = new Buffer();
         $self->init(func_get_args());
         return $self;
     });
     $Buffer->set('prototype', Buffer::$protoObject);
     $Buffer->setMethods(Buffer::$classMethods, true, false, true);
     return $Buffer;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:15,代码来源:Buffer.php

示例2: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Error = new Func(function ($str = null) {
         $error = new self($str);
         $error->stack = debug_backtrace();
         return $error;
     });
     $Error->set('prototype', self::$protoObject);
     $Error->setMethods(self::$classMethods, true, false, true);
     return $Error;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:15,代码来源:Error.php

示例3: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Boolean = new Func(function ($value = false) {
         $self = Func::getContext();
         if ($self instanceof Bln) {
             $self->value = $value ? true : false;
             return $self;
         } else {
             return $value ? true : false;
         }
     });
     $Boolean->instantiate = function () {
         return new Bln();
     };
     $Boolean->set('prototype', Bln::$protoObject);
     $Boolean->setMethods(Bln::$classMethods, true, false, true);
     return $Boolean;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:22,代码来源:Boolean.php

示例4: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $String = new Func(function ($value = '') {
         $self = Func::getContext();
         if ($self instanceof Str) {
             $self->value = to_string($value);
             return $self;
         } else {
             return to_string($value);
         }
     });
     $String->instantiate = function () {
         return new Str();
     };
     $String->set('prototype', Str::$protoObject);
     $String->setMethods(Str::$classMethods, true, false, true);
     return $String;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:22,代码来源:String.php

示例5: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Number = new Func(function ($value = 0) {
         $self = Func::getContext();
         if ($self instanceof Number) {
             $self->value = to_number($value);
             return $self;
         } else {
             return to_number($value);
         }
     });
     $Number->instantiate = function () {
         return new Number();
     };
     $Number->set('prototype', Number::$protoObject);
     $Number->setMethods(Number::$classMethods, true, false, true);
     //constants
     $Number->set('NaN', NAN);
     $Number->set('MAX_VALUE', INF);
     $Number->set('MIN_VALUE', -INF);
     $Number->set('NEGATIVE_INFINITY', -INF);
     $Number->set('POSITIVE_INFINITY', INF);
     return $Number;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:28,代码来源:Number.php

示例6: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Date = new Func(function () {
         $date = new Date();
         $date->init(func_get_args());
         return $date;
     });
     $Date->set('prototype', Date::$protoObject);
     $Date->setMethods(Date::$classMethods, true, false, true);
     return $Date;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:15,代码来源:Date.php

示例7: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Array = new Func(function ($value = null) {
         $arr = new Arr();
         $len = func_num_args();
         if ($len === 1 && is_int_or_float($value)) {
             $arr->length = (int) $value;
         } else {
             if ($len > 0) {
                 $arr->init(func_get_args());
             }
         }
         return $arr;
     });
     $Array->set('prototype', Arr::$protoObject);
     $Array->setMethods(Arr::$classMethods, true, false, true);
     return $Array;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:22,代码来源:Array.php

示例8: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Object = new Func(function ($value = null) {
         if ($value === null || $value === Object::$null) {
             return new Object();
         } else {
             return objectify($value);
         }
     });
     $Object->set('prototype', Object::$protoObject);
     $Object->setMethods(Object::$classMethods, true, false, true);
     return $Object;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:17,代码来源:Object.php

示例9: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $RegExp = new Func(function () {
         $reg = new RegExp();
         $reg->init(func_get_args());
         return $reg;
     });
     $RegExp->set('prototype', RegExp::$protoObject);
     $RegExp->setMethods(RegExp::$classMethods, true, false, true);
     return $RegExp;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:15,代码来源:RegExp.php

示例10: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Function = new Func(function ($fn) {
         throw new Ex(Error::create('Cannot construct function at runtime.'));
     });
     $Function->set('prototype', Func::$protoObject);
     $Function->setMethods(Func::$classMethods, true, false, true);
     return $Function;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:13,代码来源:Function.php


注:本文中的Func::setMethods方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。