public function getBehavior($behavior, $config = array())
    {
        $identifier = $behavior;
        if (! ($behavior instanceof AnServiceIdentifier)) {
            //Create the complete identifier if a partial identifier was passed
           if (is_string($behavior) && strpos($behavior, '.') === false) {
               $identifier = clone $this->getIdentifier();
               $identifier->path = array($identifier->path[0], 'behavior');
               $identifier->name = $behavior;
           } else {
               $identifier = $this->getIdentifier($behavior);
           }
        }

        if (! isset($this->_behaviors[$identifier->name])) {
            $config['mixer'] = $this->getMixer();
            $behavior = $this->getService($identifier, $config);

           //Check the behavior interface
           if (! ($behavior instanceof AnBehaviorInterface)) {
               throw new AnBehaviorException("Behavior $identifier does not implement AnBehaviorInterface");
           }
        } else {
            $behavior = $this->_behaviors[$identifier->name];
        }

        return $behavior;
    }
public function getBehavior($behavior, $config = array())
    {
        $identifier = $behavior;
        if (! ($behavior instanceof AnServiceIdentifier)) {
            //Create the complete identifier if a partial identifier was passed
           if (is_string($behavior) && strpos($behavior, '.') === false) {
               $identifier = clone $this->getIdentifier();
               $identifier->path = array($identifier->path[0], 'behavior');
               $identifier->name = $behavior;
           } else {
               $identifier = $this->getIdentifier($behavior);
           }
        }

        if (! isset($this->_behaviors[$identifier->name])) {
            $config['mixer'] = $this->getMixer();
            $behavior = $this->getService($identifier, $config);

           //Check the behavior interface
           if (! ($behavior instanceof AnBehaviorInterface)) {
               throw new AnBehaviorException("Behavior $identifier does not implement AnBehaviorInterface");
           }
        } else {
            $behavior = $this->_behaviors[$identifier->name];
        }

        return $behavior;
    }
public function getBehavior ( $ behavior , $ config = array ( ) ) { $ identifier = $ behavior ; if ( ! ( $ behavior instanceof AnServiceIdentifier ) ) { //Create the complete identifier if a partial identifier was passed if ( is_string ( $ behavior ) && strpos ( $ behavior , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( $ identifier -> path [ 0 ] , 'behavior' ) ; $ identifier -> name = $ behavior ; } else { $ identifier = $ this -> getIdentifier ( $ behavior ) ; } } if ( ! isset ( $ this -> _behaviors [ $ identifier -> name ] ) ) { $ config [ 'mixer' ] = $ this -> getMixer ( ) ; $ behavior = $ this -> getService ( $ identifier , $ config ) ; //Check the behavior interface if ( ! ( $ behavior instanceof AnBehaviorInterface ) ) { throw new AnBehaviorException ( "Behavior $identifier does not implement AnBehaviorInterface" ) ; } } else { $ behavior = $ this -> _behaviors [ $ identifier -> name ] ; } return $ behavior ; }
Get a behavior by identifier

@param   mixed	An object that implements AnObjectServiceable, AnServiceIdentifier object
or valid identifier string
@param	array An optional associative array of configuration settings
@return AnControllerBehaviorAbstract
Get a behavior by identifier