original_string: public function set($objectName, $object)
      {
          list(, $name) = pluginSplit($objectName);
  
          // Just call unload if the object was loaded before
          if (array_key_exists($objectName, $this->_loaded)) {
              $this->unload($objectName);
          }
          if ($this instanceof EventDispatcherInterface && $object instanceof EventListenerInterface) {
              $this->getEventManager()->on($object);
          }
          $this->_loaded[$name] = $object;
  
          return $this;
      }
code: public function set($objectName, $object)
      {
          list(, $name) = pluginSplit($objectName);
  
          // Just call unload if the object was loaded before
          if (array_key_exists($objectName, $this->_loaded)) {
              $this->unload($objectName);
          }
          if ($this instanceof EventDispatcherInterface && $object instanceof EventListenerInterface) {
              $this->getEventManager()->on($object);
          }
          $this->_loaded[$name] = $object;
  
          return $this;
      }
code_tokens: public function set ( $ objectName , $ object ) { list ( , $ name ) = pluginSplit ( $ objectName ) ; // Just call unload if the object was loaded before if ( array_key_exists ( $ objectName , $ this -> _loaded ) ) { $ this -> unload ( $ objectName ) ; } if ( $ this instanceof EventDispatcherInterface && $ object instanceof EventListenerInterface ) { $ this -> getEventManager ( ) -> on ( $ object ) ; } $ this -> _loaded [ $ name ] = $ object ; return $ this ; }
docstring: Set an object directly into the registry by name.
  
  If this collection implements events, the passed object will
  be attached into the event manager
  
  @param string $objectName The name of the object to set in the registry.
  @param object $object instance to store in the registry
  @return $this
docstring_tokens: Set an object directly into the registry by name .