public function getServiceInstanceByInterface($interface)
    {
        foreach ($this->getServiceInstances() as $info) {
            if (!isset($info['instance'])) {
                continue;
            }
            $instance = $info['instance'];

            if ($instance instanceof $interface) {
                return $instance;
            }
        }

        return false;
    }
public function getServiceInstanceByInterface($interface)
    {
        foreach ($this->getServiceInstances() as $info) {
            if (!isset($info['instance'])) {
                continue;
            }
            $instance = $info['instance'];

            if ($instance instanceof $interface) {
                return $instance;
            }
        }

        return false;
    }
public function getServiceInstanceByInterface ( $ interface ) { foreach ( $ this -> getServiceInstances ( ) as $ info ) { if ( ! isset ( $ info [ 'instance' ] ) ) { continue ; } $ instance = $ info [ 'instance' ] ; if ( $ instance instanceof $ interface ) { return $ instance ; } } return false ; }
Get single service instance by interface.

@param $interface

@return bool|ServiceInterface
Return the engine service; otherwise false if not found.
Get single service instance by interface .