當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Wire::hasHook方法代碼示例

本文整理匯總了PHP中Wire::hasHook方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wire::hasHook方法的具體用法?PHP Wire::hasHook怎麽用?PHP Wire::hasHook使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Wire的用法示例。


在下文中一共展示了Wire::hasHook方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isHooked

 /**
  * Returns true if the method/property hooked, false if it isn't.
  *
  * This is for optimization use. It does not distinguish about class instance. 
  * It only distinguishes about class if you provide a class with the $method argument (i.e. Class::).
  * As a result, a true return value indicates something "might" be hooked, as opposed to be 
  * being definitely hooked. 
  *
  * If checking for a hooked method, it should be in the form "Class::method()" or "method()". 
  * If checking for a hooked property, it should be in the form "Class::property" or "property". 
  * 
  * @param string $method Method or property name in one of the following formats:
  * 	Class::method()
  * 	Class::property
  * 	method()
  * 	property
  * @param Wire|null $instance Optional instance to check against (see isThisHooked method for details)
  * 	Note that if specifying an $instance, you may not use the Class::method() or Class::property options for $method argument.
  * @return bool
  *
  */
 public static function isHooked($method, Wire $instance = null)
 {
     if ($instance) {
         return $instance->hasHook($method);
     }
     $hooked = false;
     if (strpos($method, ':') !== false) {
         if (array_key_exists($method, self::$hookMethodCache)) {
             $hooked = true;
         }
         // fromClass::method() or fromClass::property
     } else {
         if (in_array($method, self::$hookMethodCache)) {
             $hooked = true;
         }
         // method() or property
     }
     return $hooked;
 }
開發者ID:avatar382,項目名稱:fablab_site,代碼行數:40,代碼來源:Wire.php


注:本文中的Wire::hasHook方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。