public function registerServices($services)
	{
	    
	    if (!is_array($services) && !($services instanceof Traversable)) {
	        throw new Exception\InvalidArgumentException(sprintf(
                'Expected an array or Traversable; received "%s"',
                (is_object($services) ? get_class($services) : gettype($services))
	        ));
	    }
	    
		foreach($services as $key => $impl){
		    
		    if (is_string($impl)) {
		        $impl = ['name' => $impl];
		    }
		    
			$id 		= isset($impl['id']) ? $impl['id'] : $key;
			$name 	    = isset($impl['name']) ? $impl['name'] : null;
			$service 	= isset($impl['service']) ? $impl['service'] : null;
			$factory 	= isset($impl['factory']) ? $impl['factory'] : null;
			$options 	= isset($impl['options']) ? $impl['options'] : null;
			$priority 	= isset($impl['priority']) ? $impl['priority'] : 1;
			
			if (!$service && isset($impl['class'])) {
			    $service = $impl['class'];
			}

			if(is_null($options) && isset($impl['config'])){
			    $options = $impl['config'];
			}
			
			if(!$name){
				throw new Exception\InvalidArgumentException('Service name is not defined for service: '.$id);
			}
			
			$this->registerService($id, $name, $service, $options, $priority);
			
			if (array_key_exists('enabled', $impl) && !$impl['enabled']) {
			    $this->disableService($id);
			}
			
			if($factory){
			    $this->getServicePluginManager()->setFactory(
		            $id, $factory);
			}
		}
		
		return $this;
	}
public function registerServices($services)
	{
	    
	    if (!is_array($services) && !($services instanceof Traversable)) {
	        throw new Exception\InvalidArgumentException(sprintf(
                'Expected an array or Traversable; received "%s"',
                (is_object($services) ? get_class($services) : gettype($services))
	        ));
	    }
	    
		foreach($services as $key => $impl){
		    
		    if (is_string($impl)) {
		        $impl = ['name' => $impl];
		    }
		    
			$id 		= isset($impl['id']) ? $impl['id'] : $key;
			$name 	    = isset($impl['name']) ? $impl['name'] : null;
			$service 	= isset($impl['service']) ? $impl['service'] : null;
			$factory 	= isset($impl['factory']) ? $impl['factory'] : null;
			$options 	= isset($impl['options']) ? $impl['options'] : null;
			$priority 	= isset($impl['priority']) ? $impl['priority'] : 1;
			
			if (!$service && isset($impl['class'])) {
			    $service = $impl['class'];
			}

			if(is_null($options) && isset($impl['config'])){
			    $options = $impl['config'];
			}
			
			if(!$name){
				throw new Exception\InvalidArgumentException('Service name is not defined for service: '.$id);
			}
			
			$this->registerService($id, $name, $service, $options, $priority);
			
			if (array_key_exists('enabled', $impl) && !$impl['enabled']) {
			    $this->disableService($id);
			}
			
			if($factory){
			    $this->getServicePluginManager()->setFactory(
		            $id, $factory);
			}
		}
		
		return $this;
	}
public function registerServices ( $ services ) { if ( ! is_array ( $ services ) && ! ( $ services instanceof Traversable ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Expected an array or Traversable; received "%s"' , ( is_object ( $ services ) ? get_class ( $ services ) : gettype ( $ services ) ) ) ) ; } foreach ( $ services as $ key => $ impl ) { if ( is_string ( $ impl ) ) { $ impl = [ 'name' => $ impl ] ; } $ id = isset ( $ impl [ 'id' ] ) ? $ impl [ 'id' ] : $ key ; $ name = isset ( $ impl [ 'name' ] ) ? $ impl [ 'name' ] : null ; $ service = isset ( $ impl [ 'service' ] ) ? $ impl [ 'service' ] : null ; $ factory = isset ( $ impl [ 'factory' ] ) ? $ impl [ 'factory' ] : null ; $ options = isset ( $ impl [ 'options' ] ) ? $ impl [ 'options' ] : null ; $ priority = isset ( $ impl [ 'priority' ] ) ? $ impl [ 'priority' ] : 1 ; if ( ! $ service && isset ( $ impl [ 'class' ] ) ) { $ service = $ impl [ 'class' ] ; } if ( is_null ( $ options ) && isset ( $ impl [ 'config' ] ) ) { $ options = $ impl [ 'config' ] ; } if ( ! $ name ) { throw new Exception \ InvalidArgumentException ( 'Service name is not defined for service: ' . $ id ) ; } $ this -> registerService ( $ id , $ name , $ service , $ options , $ priority ) ; if ( array_key_exists ( 'enabled' , $ impl ) && ! $ impl [ 'enabled' ] ) { $ this -> disableService ( $ id ) ; } if ( $ factory ) { $ this -> getServicePluginManager ( ) -> setFactory ( $ id , $ factory ) ; } } return $ this ; }
Batch register services

@param array|\Traversable $services
@throws \InvalidArgumentException
@return \ValuSo\Broker\ServiceLoader
Batch register services