function extend($newName, $nameOrAlias)
    {
        $throw = false;

        if ($this->has($newName))
        // New Name Alias exists as a Service or Alias
        // - Check has allow override?
        {
            if ($this->isExtendedService($newName))
            // New Name is Alias; achieve extended service
            {
                $aliasTo = $this->getExtended($newName);

                ## service from nested containers
                if (strstr($aliasTo, self::SEPARATOR)) {
                    $xService = explode(self::SEPARATOR, $aliasTo);
                    $nestName = array_pop($xService);

                    $inService = $this->from(implode(self::SEPARATOR, $xService))
                        ->_attainCService($nestName);
                }
                else
                    $inService = $this->_attainCService($aliasTo);
            } else
                $inService = $this->_attainCService($newName);

            # ..

            if (!$inService->isAllowOverride())
                $throw = array($newName, isset($aliasTo) ? $aliasTo : $newName);
        }


        if ($throw)
            throw new \Exception(sprintf(
                'A service by the name (%s) is not allowed to be overridden by (%s).',
                $throw[0], $throw[1]
            ));

        $cAlias = $this->_normalizeName($newName);
        $this->aliases[$cAlias] = $nameOrAlias;
        return $this;
    }
function extend($newName, $nameOrAlias)
    {
        $throw = false;

        if ($this->has($newName))
        // New Name Alias exists as a Service or Alias
        // - Check has allow override?
        {
            if ($this->isExtendedService($newName))
            // New Name is Alias; achieve extended service
            {
                $aliasTo = $this->getExtended($newName);

                ## service from nested containers
                if (strstr($aliasTo, self::SEPARATOR)) {
                    $xService = explode(self::SEPARATOR, $aliasTo);
                    $nestName = array_pop($xService);

                    $inService = $this->from(implode(self::SEPARATOR, $xService))
                        ->_attainCService($nestName);
                }
                else
                    $inService = $this->_attainCService($aliasTo);
            } else
                $inService = $this->_attainCService($newName);

            # ..

            if (!$inService->isAllowOverride())
                $throw = array($newName, isset($aliasTo) ? $aliasTo : $newName);
        }


        if ($throw)
            throw new \Exception(sprintf(
                'A service by the name (%s) is not allowed to be overridden by (%s).',
                $throw[0], $throw[1]
            ));

        $cAlias = $this->_normalizeName($newName);
        $this->aliases[$cAlias] = $nameOrAlias;
        return $this;
    }
function extend ( $ newName , $ nameOrAlias ) { $ throw = false ; if ( $ this -> has ( $ newName ) ) // New Name Alias exists as a Service or Alias // - Check has allow override? { if ( $ this -> isExtendedService ( $ newName ) ) // New Name is Alias; achieve extended service { $ aliasTo = $ this -> getExtended ( $ newName ) ; ## service from nested containers if ( strstr ( $ aliasTo , self :: SEPARATOR ) ) { $ xService = explode ( self :: SEPARATOR , $ aliasTo ) ; $ nestName = array_pop ( $ xService ) ; $ inService = $ this -> from ( implode ( self :: SEPARATOR , $ xService ) ) -> _attainCService ( $ nestName ) ; } else $ inService = $ this -> _attainCService ( $ aliasTo ) ; } else $ inService = $ this -> _attainCService ( $ newName ) ; # .. if ( ! $ inService -> isAllowOverride ( ) ) $ throw = array ( $ newName , isset ( $ aliasTo ) ? $ aliasTo : $ newName ) ; } if ( $ throw ) throw new \ Exception ( sprintf ( 'A service by the name (%s) is not allowed to be overridden by (%s).' , $ throw [ 0 ] , $ throw [ 1 ] ) ) ; $ cAlias = $ this -> _normalizeName ( $ newName ) ; $ this -> aliases [ $ cAlias ] = $ nameOrAlias ; return $ this ; }
Set Alias Name For Registered Service

- Alias point can be in form of "/filesystem/system/folder"
that mean, alias name is extend from "/filesystem/system/"
for "folder" service
- Aliases Can be set even if service not found
or service added later

@param string $newName     Alias
@param string $nameOrAlias Registered Service/Alias

@throws \Exception
@return $this
Set Alias Name For Registered Service