本文整理汇总了PHP中KObject::mixin方法的典型用法代码示例。如果您正苦于以下问题:PHP KObject::mixin方法的具体用法?PHP KObject::mixin怎么用?PHP KObject::mixin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KObject
的用法示例。
在下文中一共展示了KObject::mixin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mixin
/**
* Mixin an object
*
* When using mixin(), the calling object inherits the methods of the mixed in objects, in a LIFO order.
*
* @@param mixed $mixin An object that implements KObjectMixinInterface, KObjectIdentifier object
* or valid identifier string
* @param array $config An optional associative array of configuration options
* @return KObject
*/
public function mixin($mixin, $config = array())
{
if ($mixin instanceof KControllerBehaviorAbstract) {
$actions = $this->getActions();
foreach ($mixin->getMethods() as $method) {
if (substr($method, 0, 7) == '_action') {
$actions[] = strtolower(substr($method, 7));
}
}
$this->_actions = array_unique($actions);
}
return parent::mixin($mixin, $config);
}
示例2: mixin
/**
* Mixin an object
*
* @param object An object that implements KMinxInterface
* @return KObject
*/
public function mixin(KMixinInterface $object, $config = array())
{
if ($object instanceof KControllerBehaviorAbstract) {
foreach ($object->getMethods() as $method) {
if (substr($method, 0, 7) == '_action') {
$this->_actions[] = strtolower(substr($method, 7));
}
}
$this->_actions = array_unique(array_merge($this->_actions, array_keys($this->_action_map)));
}
return parent::mixin($object, $config);
}