code/event/subscriber/factory.php
public function registerSubscriber($identifier, array $config = array())
    {
        $result = false;

        //Create the complete identifier if a partial identifier was passed
        if (is_string($identifier) && strpos($identifier, '.') === false)
        {
            $identifier = $this->getIdentifier()->toArray();
            $identifier['path'] = array('event', 'subscriber');
            $identifier['name'] = $identifier;
        }

        $identifier = $this->getIdentifier($identifier);
        $class      = $this->getObject('manager')->getClass($identifier);

        if(!$class || !array_key_exists('Kodekit\Library\EventSubscriberInterface', class_implements($class)))
        {
            throw new \UnexpectedValueException(
                'Event Subscriber: '.$identifier.' does not implement Kodekit\Library\EventSubscriberInterface'
            );
        }

        if (!isset($this->__subscribers[(string)$identifier]))
        {
            $listeners = call_user_func(array($class, 'getEventListeners'));/*$class::getEventListeners();*/

            if (!empty($listeners))
            {
                $identifier->getConfig()->merge($config);

                foreach($listeners as $listener) {
                    $this->__listeners[$listener][] = $identifier;
                }
            }

            $this->__subscribers[(string)$identifier] = true;
        }

        return $result;
    }
public function registerSubscriber($identifier, array $config = array())
    {
        $result = false;

        //Create the complete identifier if a partial identifier was passed
        if (is_string($identifier) && strpos($identifier, '.') === false)
        {
            $identifier = $this->getIdentifier()->toArray();
            $identifier['path'] = array('event', 'subscriber');
            $identifier['name'] = $identifier;
        }

        $identifier = $this->getIdentifier($identifier);
        $class      = $this->getObject('manager')->getClass($identifier);

        if(!$class || !array_key_exists('Kodekit\Library\EventSubscriberInterface', class_implements($class)))
        {
            throw new \UnexpectedValueException(
                'Event Subscriber: '.$identifier.' does not implement Kodekit\Library\EventSubscriberInterface'
            );
        }

        if (!isset($this->__subscribers[(string)$identifier]))
        {
            $listeners = call_user_func(array($class, 'getEventListeners'));/*$class::getEventListeners();*/

            if (!empty($listeners))
            {
                $identifier->getConfig()->merge($config);

                foreach($listeners as $listener) {
                    $this->__listeners[$listener][] = $identifier;
                }
            }

            $this->__subscribers[(string)$identifier] = true;
        }

        return $result;
    }
public function registerSubscriber ( $ identifier , array $ config = array ( ) ) { $ result = false ; //Create the complete identifier if a partial identifier was passed if ( is_string ( $ identifier ) && strpos ( $ identifier , '.' ) === false ) { $ identifier = $ this -> getIdentifier ( ) -> toArray ( ) ; $ identifier [ 'path' ] = array ( 'event' , 'subscriber' ) ; $ identifier [ 'name' ] = $ identifier ; } $ identifier = $ this -> getIdentifier ( $ identifier ) ; $ class = $ this -> getObject ( 'manager' ) -> getClass ( $ identifier ) ; if ( ! $ class || ! array_key_exists ( 'Kodekit\Library\EventSubscriberInterface' , class_implements ( $ class ) ) ) { throw new \ UnexpectedValueException ( 'Event Subscriber: ' . $ identifier . ' does not implement Kodekit\Library\EventSubscriberInterface' ) ; } if ( ! isset ( $ this -> __subscribers [ ( string ) $ identifier ] ) ) { $ listeners = call_user_func ( array ( $ class , 'getEventListeners' ) ) ; /*$class::getEventListeners();*/ if ( ! empty ( $ listeners ) ) { $ identifier -> getConfig ( ) -> merge ( $ config ) ; foreach ( $ listeners as $ listener ) { $ this -> __listeners [ $ listener ] [ ] = $ identifier ; } } $ this -> __subscribers [ ( string ) $ identifier ] = true ; } return $ result ; }
Register an subscriber

@param string $identifier A subscriber identifier string
@param  array $config  An optional associative array of configuration options
@throws \UnexpectedValueException
@return bool Returns TRUE on success, FALSE on failure.
Register an subscriber