src/ServiceContainer.php
public function registerDefinition($id, array $definition, $isShared = true)
    {
        if (isset($this->immutable[$id])) {
            throw new ContainerException(sprintf(
                'A service by the name "%s" already exists and cannot be overridden',
                $id
            ));
        }

        $this->definition[$id] = $definition;
        $this->keys[$id] = boolval($isShared);

        if (isset($this->aliases[$id])) {
            unset($this->aliases[$id]);
        }
    }
public function registerDefinition($id, array $definition, $isShared = true)
    {
        if (isset($this->immutable[$id])) {
            throw new ContainerException(sprintf(
                'A service by the name "%s" already exists and cannot be overridden',
                $id
            ));
        }

        $this->definition[$id] = $definition;
        $this->keys[$id] = boolval($isShared);

        if (isset($this->aliases[$id])) {
            unset($this->aliases[$id]);
        }
    }
public function registerDefinition ( $ id , array $ definition , $ isShared = true ) { if ( isset ( $ this -> immutable [ $ id ] ) ) { throw new ContainerException ( sprintf ( 'A service by the name "%s" already exists and cannot be overridden' , $ id ) ) ; } $ this -> definition [ $ id ] = $ definition ; $ this -> keys [ $ id ] = boolval ( $ isShared ) ; if ( isset ( $ this -> aliases [ $ id ] ) ) { unset ( $ this -> aliases [ $ id ] ) ; } }
Register array of definition, which will be used to create the service.

@param string $id Identifier of the service.
@param array $definition Array of service definition.
@param bool $isShared Indicating whether or not the service is shared.
@throws ContainerException Error while service already exists and cannot
be overridden.
Register array of definition which will be used to create the service .