public function registerService(BindingInterface $binding, $name = NULL)
	{
		$key = ($name === NULL) ? $binding->getTypeName() : (string)$name;
		
		if(isset($this->bindings[$key]))
		{
			throw new DuplicateServiceRegistrationException(sprintf('Service "%s" is already registered', $key));
		}
		
		$this->bindings[$key] = $binding;
	}
public function registerService(BindingInterface $binding, $name = NULL)
	{
		$key = ($name === NULL) ? $binding->getTypeName() : (string)$name;
		
		if(isset($this->bindings[$key]))
		{
			throw new DuplicateServiceRegistrationException(sprintf('Service "%s" is already registered', $key));
		}
		
		$this->bindings[$key] = $binding;
	}
public function registerService ( BindingInterface $ binding , $ name = NULL ) { $ key = ( $ name === NULL ) ? $ binding -> getTypeName ( ) : ( string ) $ name ; if ( isset ( $ this -> bindings [ $ key ] ) ) { throw new DuplicateServiceRegistrationException ( sprintf ( 'Service "%s" is already registered' , $ key ) ) ; } $ this -> bindings [ $ key ] = $ binding ; }
Register a binding in the locator, will use the name of the bound type when no
name for the service is given.

@param BindingInterface $binding The binding being used to load the service.
@param string $name Optional name of the registered service.

@throws DuplicateServiceRegistrationException
Register a binding in the locator will use the name of the bound type when no name for the service is given .