function setImplementation($nameOrAlias, $implement)
    {
        if ($this->has($nameOrAlias))
            throw new \Exception(
                "Service ({$nameOrAlias}) is already exists;"
                ."Interface must define before service registration."
            );

        if ( is_string($implement) && !(interface_exists($implement) || class_exists($implement)) )
            throw new \InvalidArgumentException(
                "Invalid interface arguments, this must be valid interface name; given ({$implement})."
            );


        if (is_object($implement))
            $implement = get_class($implement);


        $normalizedName = $this->_normalizeName($nameOrAlias);
        $implementation = trim((string) $implement, '\\');
        if ( false !== array_key_exists($implementation, $this->implementations) )
            throw new \Exception(sprintf(
                'Implementation (%s) is defined.'
                    , $implementation
            ));

        $this->implementations[$normalizedName] = $implementation; // trim [\]Poirot\Classes


        // set Implementation Aliases to Service name
        $this->extend($implementation, $nameOrAlias);
        return $this;
    }
function setImplementation($nameOrAlias, $implement)
    {
        if ($this->has($nameOrAlias))
            throw new \Exception(
                "Service ({$nameOrAlias}) is already exists;"
                ."Interface must define before service registration."
            );

        if ( is_string($implement) && !(interface_exists($implement) || class_exists($implement)) )
            throw new \InvalidArgumentException(
                "Invalid interface arguments, this must be valid interface name; given ({$implement})."
            );


        if (is_object($implement))
            $implement = get_class($implement);


        $normalizedName = $this->_normalizeName($nameOrAlias);
        $implementation = trim((string) $implement, '\\');
        if ( false !== array_key_exists($implementation, $this->implementations) )
            throw new \Exception(sprintf(
                'Implementation (%s) is defined.'
                    , $implementation
            ));

        $this->implementations[$normalizedName] = $implementation; // trim [\]Poirot\Classes


        // set Implementation Aliases to Service name
        $this->extend($implementation, $nameOrAlias);
        return $this;
    }
function setImplementation ( $ nameOrAlias , $ implement ) { if ( $ this -> has ( $ nameOrAlias ) ) throw new \ Exception ( "Service ({$nameOrAlias}) is already exists;" . "Interface must define before service registration." ) ; if ( is_string ( $ implement ) && ! ( interface_exists ( $ implement ) || class_exists ( $ implement ) ) ) throw new \ InvalidArgumentException ( "Invalid interface arguments, this must be valid interface name; given ({$implement})." ) ; if ( is_object ( $ implement ) ) $ implement = get_class ( $ implement ) ; $ normalizedName = $ this -> _normalizeName ( $ nameOrAlias ) ; $ implementation = trim ( ( string ) $ implement , '\\' ) ; if ( false !== array_key_exists ( $ implementation , $ this -> implementations ) ) throw new \ Exception ( sprintf ( 'Implementation (%s) is defined.' , $ implementation ) ) ; $ this -> implementations [ $ normalizedName ] = $ implementation ; // trim [\]Poirot\Classes // set Implementation Aliases to Service name $ this -> extend ( $ implementation , $ nameOrAlias ) ; return $ this ; }
Set Service Implementation Interface Contract
we also be able to get service with defined implementation

$implement:
- string '\InterfaceName'
- object get implemented interfaces

@param string        $nameOrAlias Service name
@param string|object $implement   Interface Or Object Implementation

@throws \Exception
@return $this
Set Service Implementation Interface Contract we also be able to get service with defined implementation