当前位置: 首页>>代码示例>>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;未经允许,请勿转载。