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


PHP ObjectMixin::getExtensionMethod方法代码示例

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


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

示例1: 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

示例2: __call

 public function __call($name, $args)
 {
     if ($callback = Nette\Utils\ObjectMixin::getExtensionMethod(get_class($this), $name)) {
         return Nette\Utils\Callback::invoke($callback, $this, ...$args);
     }
     return parent::__call($name, $args);
 }
开发者ID:nette,项目名称:forms,代码行数:7,代码来源:BaseControl.php

示例3: 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

示例4: registerReplicator

 private function registerReplicator()
 {
     if (!ObjectMixin::getExtensionMethod(SubmitButton::class, 'addCreateOnClick')) {
         Replicator::register();
     }
 }
开发者ID:librette,项目名称:doctrine-forms,代码行数:6,代码来源:ReplicatorBuilder.php

示例5: __call

 public function __call($name, $args)
 {
     if ($callback = Nette\Utils\ObjectMixin::getExtensionMethod(__CLASS__, $name)) {
         return $callback($this, ...$args);
     }
     Nette\Utils\ObjectMixin::strictCall(__CLASS__, $name);
 }
开发者ID:nette,项目名称:finder,代码行数:7,代码来源: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::getExtensionMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。