public function addService(string $serviceName, ServiceDefinitionInterface $serviceDefinition, bool $isShared = true) 
    {
        if ($this->invalidServiceBuilderString($serviceName))
        {
            throw new ContainerBuilderException('The "'.$serviceName.'" servicename must be a string, cannot be numeric, empty or contain any special characters except "." and "_".');
        }

        // add the service definition
        $this->services[$serviceName] = $serviceDefinition;

        // generate the normalized name
        $this->generateNormalizedServiceName($serviceName);

        // set the shared unshared flag
        if ($isShared && (!in_array($serviceName, $this->shared)))
        {
            $this->shared[] = $serviceName;
        } 
        elseif ((!$isShared) && in_array($serviceName, $this->shared))
        {
            unset($this->shared[array_search($serviceName, $this->shared)]);
        }
    }
public function addService(string $serviceName, ServiceDefinitionInterface $serviceDefinition, bool $isShared = true) 
    {
        if ($this->invalidServiceBuilderString($serviceName))
        {
            throw new ContainerBuilderException('The "'.$serviceName.'" servicename must be a string, cannot be numeric, empty or contain any special characters except "." and "_".');
        }

        // add the service definition
        $this->services[$serviceName] = $serviceDefinition;

        // generate the normalized name
        $this->generateNormalizedServiceName($serviceName);

        // set the shared unshared flag
        if ($isShared && (!in_array($serviceName, $this->shared)))
        {
            $this->shared[] = $serviceName;
        } 
        elseif ((!$isShared) && in_array($serviceName, $this->shared))
        {
            unset($this->shared[array_search($serviceName, $this->shared)]);
        }
    }
public function addService ( string $ serviceName , ServiceDefinitionInterface $ serviceDefinition , bool $ isShared = true ) { if ( $ this -> invalidServiceBuilderString ( $ serviceName ) ) { throw new ContainerBuilderException ( 'The "' . $ serviceName . '" servicename must be a string, cannot be numeric, empty or contain any special characters except "." and "_".' ) ; } // add the service definition $ this -> services [ $ serviceName ] = $ serviceDefinition ; // generate the normalized name $ this -> generateNormalizedServiceName ( $ serviceName ) ; // set the shared unshared flag if ( $ isShared && ( ! in_array ( $ serviceName , $ this -> shared ) ) ) { $ this -> shared [ ] = $ serviceName ; } elseif ( ( ! $ isShared ) && in_array ( $ serviceName , $ this -> shared ) ) { unset ( $ this -> shared [ array_search ( $ serviceName , $ this -> shared ) ] ) ; } }
Add a service definition instance to the container builder.

@param string                        $serviceName
@param ServiceDefinitionInterface    $serviceDefinition
@return void
Add a service definition instance to the container builder .