Example #1
0
 /**
  * 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);
 }
Example #2
0
    /**
     * Mixin an object
     *
     * When using mixin(), the calling object inherits the methods of the mixed
     * in objects, in a LIFO order. 
     *
     * @param   object  An object that implements KMinxInterface
     * @return  KObject
     */
    public function mixin(KMixinInterface $object)
    {
        $methods = $object->getMixableMethods($this);

        foreach($methods as $method) {
            $this->_mixed_methods[$method] = $object;
        }
        
        //Set the mixer
        $object->setMixer($this);
        
        return $this;
    }
Example #3
0
 /**
  * Mixin an object
  *
  * When using mixin(), the calling object inherits the methods of the mixed
  * in objects, in a LIFO order. 
  * 
  * This function notifies the mixing through the onMixin function it is being
  * mixed.
  *
  * @param   object  An object that implements KMinxInterface
  * @return  KObject
  */
 public function mixin(KMixinInterface $object)
 {
     $methods = $object->getMixableMethods($this);
     foreach ($methods as $method) {
         $this->_mixed_methods[$method] = $object;
     }
     //Notify the mixin
     $object->mixer = $this;
     $object->onMixin();
     return $this;
 }