public function setLoader(ServiceLoader $loader){

		$this->loader = $loader;
		$that = $this;

		$this->loader->addInitializer(function ($instance) use ($that) {

		    // Inject broker to services
		    if ($instance instanceof Feature\ServiceBrokerAwareInterface) {
		        $instance->setServiceBroker($that);
		    }

		    // Inject event manager to services
		    if ($instance instanceof EventManagerAwareInterface) {
		        $instance->setEventManager($that->getEventManager());
		    }
		});

		return $this;
	}
public function setLoader(ServiceLoader $loader){

		$this->loader = $loader;
		$that = $this;

		$this->loader->addInitializer(function ($instance) use ($that) {

		    // Inject broker to services
		    if ($instance instanceof Feature\ServiceBrokerAwareInterface) {
		        $instance->setServiceBroker($that);
		    }

		    // Inject event manager to services
		    if ($instance instanceof EventManagerAwareInterface) {
		        $instance->setEventManager($that->getEventManager());
		    }
		});

		return $this;
	}
public function setLoader ( ServiceLoader $ loader ) { $ this -> loader = $ loader ; $ that = $ this ; $ this -> loader -> addInitializer ( function ( $ instance ) use ( $ that ) { // Inject broker to services if ( $ instance instanceof Feature \ ServiceBrokerAwareInterface ) { $ instance -> setServiceBroker ( $ that ) ; } // Inject event manager to services if ( $ instance instanceof EventManagerAwareInterface ) { $ instance -> setEventManager ( $ that -> getEventManager ( ) ) ; } } ) ; return $ this ; }
Set service loader instance

@param ServiceLoader $loader
Set service loader instance