public function registerService($object, $name = NULL)
	{
		if(!is_object($object))
		{
			throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
		}
		
		$key = ($name === NULL) ? get_class($object) : (string)$name;
		
		if(isset($this->services[$key]))
		{
			throw new DuplicateServiceRegistrationException(sprintf('Service "%s" is already registered', $key));
		}
		
		$this->services[$key] = $object;
	}
public function registerService($object, $name = NULL)
	{
		if(!is_object($object))
		{
			throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
		}
		
		$key = ($name === NULL) ? get_class($object) : (string)$name;
		
		if(isset($this->services[$key]))
		{
			throw new DuplicateServiceRegistrationException(sprintf('Service "%s" is already registered', $key));
		}
		
		$this->services[$key] = $object;
	}
public function registerService ( $ object , $ name = NULL ) { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Expecting an object, given %s' , gettype ( $ object ) ) ) ; } $ key = ( $ name === NULL ) ? get_class ( $ object ) : ( string ) $ name ; if ( isset ( $ this -> services [ $ key ] ) ) { throw new DuplicateServiceRegistrationException ( sprintf ( 'Service "%s" is already registered' , $ key ) ) ; } $ this -> services [ $ key ] = $ object ; }
Register the given object instance under the given name, defaults to the fully-qualified
type name of the object instance when no name is given.

@param object $object The object instance to be registered.
@param string $name An optional name for the service.

@throws \InvalidArgumentException When no object instance has been given.
@throws DuplicateServiceRegistrationException
Register the given object instance under the given name defaults to the fully - qualified type name of the object instance when no name is given .