protected function _validateImplementation($serviceName, $instance)
    {
        if (false === $implement = $this->hasImplementation($serviceName))
            ## we have not defined implementation, nothing to do
            return;

        // ..

        $throw = true;
        if (interface_exists($implement))
            ## check implementation of given interface
            $throw = !(in_array($implement, class_implements($instance)));
        elseif (class_exists($implement))
            ## check implementation of extended class
            $throw = !($instance instanceof $implement || is_subclass_of($instance, $implement));

        if ($throw)
            throw new \Exception(sprintf(
                'Service with name (%s) must implement (%s); given: %s'
                , $serviceName, $implement, \Poirot\Std\flatten($instance)
            ));
    }
protected function _validateImplementation($serviceName, $instance)
    {
        if (false === $implement = $this->hasImplementation($serviceName))
            ## we have not defined implementation, nothing to do
            return;

        // ..

        $throw = true;
        if (interface_exists($implement))
            ## check implementation of given interface
            $throw = !(in_array($implement, class_implements($instance)));
        elseif (class_exists($implement))
            ## check implementation of extended class
            $throw = !($instance instanceof $implement || is_subclass_of($instance, $implement));

        if ($throw)
            throw new \Exception(sprintf(
                'Service with name (%s) must implement (%s); given: %s'
                , $serviceName, $implement, \Poirot\Std\flatten($instance)
            ));
    }
protected function _validateImplementation ( $ serviceName , $ instance ) { if ( false === $ implement = $ this -> hasImplementation ( $ serviceName ) ) ## we have not defined implementation, nothing to do return ; // .. $ throw = true ; if ( interface_exists ( $ implement ) ) ## check implementation of given interface $ throw = ! ( in_array ( $ implement , class_implements ( $ instance ) ) ) ; elseif ( class_exists ( $ implement ) ) ## check implementation of extended class $ throw = ! ( $ instance instanceof $ implement || is_subclass_of ( $ instance , $ implement ) ) ; if ( $ throw ) throw new \ Exception ( sprintf ( 'Service with name (%s) must implement (%s); given: %s' , $ serviceName , $ implement , \ Poirot \ Std \ flatten ( $ instance ) ) ) ; }
validate interface against attained service instance
@param string $serviceName
@param object|mixed $instance
@throws \Exception
validate interface against attained service instance