本文整理匯總了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);
}