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


PHP BehaviorCollection::hasMethod方法代碼示例

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


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

示例1: testHasMethodAsCallback

 /**
  * test hasMethod returning a 'callback'
  *
  * @return void
  */
 public function testHasMethodAsCallback()
 {
     new Sample();
     $Collection = new BehaviorCollection();
     $Collection->init('Sample', array('Test', 'Test2'));
     $result = $Collection->hasMethod('testMethod', true);
     $expected = array('Test', 'testMethod');
     $this->assertEquals($expected, $result);
     $result = $Collection->hasMethod('resolveMethod', true);
     $expected = array('Test2', 'resolveMethod');
     $this->assertEquals($expected, $result);
     $result = $Collection->hasMethod('mappingRobotOnTheRoof', true);
     $expected = array('Test2', 'mapped', 'mappingRobotOnTheRoof');
     $this->assertEquals($expected, $result);
 }
開發者ID:magooemp,項目名稱:eramba,代碼行數:20,代碼來源:BehaviorCollectionTest.php

示例2: hasMethod

 /**
  * Check that a method is callable on a model.  This will check both the model's own methods, its
  * inherited methods and methods that could be callable through behaviors.
  *
  * @param string $method The method to be called.
  * @return boolean True on method being callable.
  */
 public function hasMethod($method)
 {
     if (method_exists($this, $method)) {
         return true;
     }
     if ($this->Behaviors->hasMethod($method)) {
         return true;
     }
     return false;
 }
開發者ID:Chromedian,項目名稱:inventory,代碼行數:17,代碼來源:Model.php

示例3: hasMethod

 /**
  * Check that a method is callable on a model. This will check both the model's own methods, its
  * inherited methods and methods that could be callable through behaviors.
  *
  * @param string $method The method to be called.
  *
  * @return bool True on method being callable.
  */
 public function hasMethod($method)
 {
     if (method_exists($this, $method)) {
         return TRUE;
     }
     return $this->Behaviors->hasMethod($method);
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:15,代碼來源:Model.php


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