當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。