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


PHP ObjectMixin::setExtensionMethod方法代码示例

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


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

示例1: registerControls

 public static function registerControls()
 {
     ObjectMixin::setExtensionMethod(Container::class, 'addDatePicker', function (Container $container, $name, $label = null) {
         return $container[$name] = new Controls\DatePicker($label);
     });
     ObjectMixin::setExtensionMethod(Container::class, 'addDateTimePicker', function (Container $container, $name, $label = null) {
         return $container[$name] = new Controls\DateTimePicker($label);
     });
     ObjectMixin::setExtensionMethod(Container::class, 'addTypeahead', function (Container $container, $name, $label = null, $callback = null) {
         return $container[$name] = new Controls\Typeahead($label, $callback);
     });
 }
开发者ID:nextras,项目名称:forms,代码行数:12,代码来源:FormsExtension.php

示例2: extensionMethod

 /**
  * Adding method to class.
  *
  * @param $name
  * @param null $callback
  *
  * @throws \Nette\MemberAccessException
  * @return callable|null
  */
 public static function extensionMethod($name, $callback = NULL)
 {
     if (strpos($name, '::') === FALSE) {
         $class = get_called_class();
     } else {
         list($class, $name) = explode('::', $name);
     }
     if ($callback === NULL) {
         return ObjectMixin::getExtensionMethod($class, $name);
     } else {
         ObjectMixin::setExtensionMethod($class, $name, $callback);
     }
 }
开发者ID:Richmond77,项目名称:learning-nette,代码行数:22,代码来源:EventManager.php

示例3: extensionMethod

 public static function extensionMethod($name, $callback = NULL)
 {
     if (strpos($name, '::') !== FALSE) {
         // back compatibility
         list(, $name) = explode('::', $name);
     }
     Nette\Utils\ObjectMixin::setExtensionMethod(get_called_class(), $name, $callback);
 }
开发者ID:nette,项目名称:forms,代码行数:8,代码来源:BaseControl.php

示例4: extensionMethod

 /**
  * @return mixed
  * @deprecated use Nette\Utils\ObjectMixin::setExtensionMethod()
  */
 public static function extensionMethod($name, $callback = NULL)
 {
     if (strpos($name, '::') === FALSE) {
         $class = get_called_class();
     } else {
         list($class, $name) = explode('::', $name);
         $class = (new \ReflectionClass($class))->getName();
     }
     trigger_error("Extension methods such as {$class}::{$name}() are deprecated" . ObjectMixin::getSource(), E_USER_DEPRECATED);
     if ($callback === NULL) {
         return ObjectMixin::getExtensionMethod($class, $name);
     } else {
         ObjectMixin::setExtensionMethod($class, $name, $callback);
     }
 }
开发者ID:nette,项目名称:utils,代码行数:19,代码来源:SmartObject.php

示例5: extensionMethod

 public static function extensionMethod($name, $callback)
 {
     Nette\Utils\ObjectMixin::setExtensionMethod(__CLASS__, $name, $callback);
 }
开发者ID:nette,项目名称:finder,代码行数:4,代码来源:Finder.php

示例6: extensionMethod

 /**
  * Adding method to class.
  * @param  string  method name
  * @param  callable
  * @return mixed
  */
 public static function extensionMethod($name, $callback = NULL)
 {
     if (strpos($name, '::') === FALSE) {
         $class = get_called_class();
     } else {
         list($class, $name) = explode('::', $name);
         $class = (new \ReflectionClass($class))->getName();
     }
     if ($callback === NULL) {
         return Nette\Utils\ObjectMixin::getExtensionMethod($class, $name);
     } else {
         Nette\Utils\ObjectMixin::setExtensionMethod($class, $name, $callback);
     }
 }
开发者ID:manGoweb,项目名称:mnamGo,代码行数:20,代码来源:Object.php


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